Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save timrobinson88/9773252 to your computer and use it in GitHub Desktop.
Save timrobinson88/9773252 to your computer and use it in GitHub Desktop.
phase 0 unit 2 week 1boggle class challenge
class BoggleBoard
def initialize(dice_grid)
@dice_grid = dice_grid
end
def get_row(row)
@dice_grid[row]
end
def get_col(col)
@dice_grid.map {|x| x[col]}
end
def create_word(*coords)
coords.map { |coord| @dice_grid[coord.first][coord.last]}.join("")
end
end
dice_grid = [["b", "r", "a", "e"],
["i", "o", "d", "t"],
["e", "c", "l", "r"],
["t", "a", "k", "e"]]
boggle_board = BoggleBoard.new(dice_grid)
# implement tests for each of the methods here:
# create driver test code to retrieve a value at a coordinate here:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment