Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (16 sloc) 364 Bytes
defmodule Board.List2D do
@behaviour Board
def new do
Enum.map(1..9, fn _ ->
Enum.map(1..9, fn _ -> nil end)
end)
end
def get(board, x, y), do: board |> Enum.at(x) |> Enum.at(y)
def set(board, x, y, value) do
column =
board
|> Enum.at(x)
|> List.replace_at(y, value)
List.replace_at(board, x, column)
end
end
You can’t perform that action at this time.