1
0
mirror of https://github.com/danbee/chess synced 2025-03-04 08:39:06 +00:00
chess/lib/chess/moves/pieces/king.ex
2018-03-31 15:21:47 -04:00

14 lines
288 B
Elixir

defmodule Chess.Moves.Pieces.King do
@moduledoc false
alias Chess.Moves.Generator
def moves(board, {file, rank}) do
Generator.moves(board, {file, rank}, patterns())
end
defp patterns do
[{1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}, {0, 1}]
end
end