Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Blockr Part 2: Board

4_blockr_walls.livemd

Blockr Part 2: Board

import IEx.Helpers
alias Blockr.Game.{Board, Tetromino, Canvas}

Confirm Canvas

Canvas.new([{0, 0}, {21, 11}])
# [for row <- 0..21 do
#   [{row, 0}, {row, 11}]
# end,
# for col <- 1..10 do
#   [{0, col}, {21, col}]
# end]

for row <- 0..21, col <- 0..11, row in [0, 21] or col in [0, 11] do
  {row, col}
end
[
  {0, 0},
  {0, 1},
  {0, 2},
  {0, 3},
  {0, 4},
  {0, 5},
  {0, 6},
  {0, 7},
  {0, 8},
  {0, 9},
  {0, 10},
  {0, 11},
  {1, 0},
  {1, 11},
  {2, 0},
  {2, 11},
  {3, 0},
  {3, 11},
  {4, 0},
  {4, 11},
  {5, 0},
  {5, 11},
  {6, 0},
  {6, 11},
  {7, 0},
  {7, 11},
  {8, 0},
  {8, 11},
  {9, 0},
  {9, 11},
  {10, 0},
  {10, 11},
  {11, 0},
  {11, 11},
  {12, 0},
  {12, 11},
  {13, 0},
  {13, 11},
  {14, 0},
  {14, 11},
  {15, 0},
  {15, 11},
  {16, 0},
  {16, 11},
  {17, 0},
  {17, 11},
  {18, 0},
  {18, 11},
  {19, ...},
  {...},
  ...
]
Board.new().walls
|> Canvas.new()