support boards that wrap

This commit is contained in:
Gavin McDonald
2019-01-13 15:24:32 -05:00
parent 74aa4bd1d1
commit 99aba23df6
2 changed files with 3 additions and 4 deletions

View File

@@ -16,8 +16,8 @@ defmodule ExMine.Game do
@report_to_user [:play_time, :state, :update]
def new_game(height, width) do
board = Cartographer.new_board(height, width)
def new_game(height, width, wrap \\ :wrap) do
board = Cartographer.new_board(height, width, wrap)
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)