support boards that wrap
This commit is contained in:
@@ -16,8 +16,8 @@ defmodule ExMine.Game do
|
|||||||
|
|
||||||
@report_to_user [:play_time, :state, :update]
|
@report_to_user [:play_time, :state, :update]
|
||||||
|
|
||||||
def new_game(height, width) do
|
def new_game(height, width, wrap \\ :wrap) do
|
||||||
board = Cartographer.new_board(height, width)
|
board = Cartographer.new_board(height, width, wrap)
|
||||||
tiles = for x <- 0..(width - 1), y <- 0..(height - 1), do: {x, y}
|
tiles = for x <- 0..(width - 1), y <- 0..(height - 1), do: {x, y}
|
||||||
|
|
||||||
Enum.reduce(tiles, %ExMine.Game{board: board}, fn({x, y}, game) -> new_tile(game, x, y) end)
|
Enum.reduce(tiles, %ExMine.Game{board: board}, fn({x, y}, game) -> new_tile(game, x, y) end)
|
||||||
|
|||||||
3
mix.exs
3
mix.exs
@@ -23,8 +23,7 @@ defmodule ExMine.MixProject do
|
|||||||
defp deps do
|
defp deps do
|
||||||
[
|
[
|
||||||
{:cartographer, git: "git@gitea.daggertrout.com:mcdoh/Cartographer.git"},
|
{:cartographer, git: "git@gitea.daggertrout.com:mcdoh/Cartographer.git"},
|
||||||
# {:dep_from_hexpm, "~> 0.3.0"},
|
# {:cartographer, path: "../cartographer"},
|
||||||
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
|
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user