mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Consistent language
This commit is contained in:
parent
ab9900d1e3
commit
edda70b4f2
@ -13,7 +13,7 @@ defmodule Chess.Moves.Rook do
|
||||
defp moves_north(board, {file, rank}) do
|
||||
board["#{file},#{rank}"]
|
||||
|> Map.get("colour")
|
||||
|> Generator.moves(board, {file, rank}, {0, +1})
|
||||
|> Generator.moves(board, {file, rank}, {0, 1})
|
||||
end
|
||||
|
||||
defp moves_south(board, {file, rank}) do
|
||||
@ -25,7 +25,7 @@ defmodule Chess.Moves.Rook do
|
||||
defp moves_east(board, {file, rank}) do
|
||||
board["#{file},#{rank}"]
|
||||
|> Map.get("colour")
|
||||
|> Generator.moves(board, {file, rank}, {+1, 0})
|
||||
|> Generator.moves(board, {file, rank}, {1, 0})
|
||||
end
|
||||
|
||||
defp moves_west(board, {file, rank}) do
|
||||
|
||||
@ -14,7 +14,7 @@ defmodule Chess.Moves.RookTest do
|
||||
assert Enum.sort(moves) == expected_moves
|
||||
end
|
||||
|
||||
test "rook cannot move further than the edge" do
|
||||
test "rooks cannot move further than the edge" do
|
||||
board = %{"0,0" => %{"type" => "rook", "colour" => "white"}}
|
||||
moves = Moves.available(board, {0, 0})
|
||||
|
||||
@ -25,7 +25,7 @@ defmodule Chess.Moves.RookTest do
|
||||
assert Enum.sort(moves) == expected_moves
|
||||
end
|
||||
|
||||
test "rook is obstructed by another piece of the same colour" do
|
||||
test "rooks are blocked by another piece of the same colour" do
|
||||
board = %{
|
||||
"0,0" => %{"type" => "rook", "colour" => "white"},
|
||||
"0,5" => %{"type" => "king", "colour" => "white"},
|
||||
@ -39,7 +39,7 @@ defmodule Chess.Moves.RookTest do
|
||||
assert Enum.sort(moves) == expected_moves
|
||||
end
|
||||
|
||||
test "rook can take a piece of the opposite colour" do
|
||||
test "rooks can take an opponents piece" do
|
||||
board = %{
|
||||
"0,0" => %{"type" => "rook", "colour" => "white"},
|
||||
"0,5" => %{"type" => "knight", "colour" => "black"},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user