module Text2048::MonkeyPatch::Array::Board

2048 related methods

Public Instance Methods

hashinize() click to toggle source
# File lib/text2048/monkey_patch/array/board.rb, line 9
def hashinize
  col_row = [0, 1, 2, 3].product([0, 1, 2, 3])
  col_row.each_with_object({}) do |(col, row), memo|
    tile = self[col][row]
    memo[[col, row]] =
      tile.respond_to?(:status) ? tile : Text2048::Tile.new(tile)
  end
end