defmodule Chess.Moves do
  @moduledoc false

  alias Chess.Moves.Pawn
  alias Chess.Moves.Rook

  def available(board, {file, rank}) do
    piece = board["#{file},#{rank}"]

    case piece do
      %{"type" => "pawn"} ->
        Pawn.moves(board, {file, rank})
      %{"type" => "rook"} ->
        Rook.moves(board, {file, rank})
    end
  end
end

defmodule Chess.Moves do
  @moduledoc false

  alias Chess.Moves.Pawn
  alias Chess.Moves.Rook

  def available(board, {file, rank}) do
    piece = board["#{file},#{rank}"]

    case piece do
      %{"type" => "pawn"} ->
        Pawn.moves(board, {file, rank})
      %{"type" => "rook"} ->
        Rook.moves(board, {file, rank})
      %{"type" => "bishop"} ->
        []
      %{"type" => "knight"} ->
        []
      %{"type" => "king"} ->
        []
      %{"type" => "queen"} ->
        []
    end
  end
end

Stop all other pieces causing an error
Stop all other pieces causing an error

danbee/chess,danbee/chess,danbee/chess