mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
14 lines
288 B
Elixir
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
|