Forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
Last active
December 28, 2015 02:09
-
-
Save amahesh0501/7426388 to your computer and use it in GitHub Desktop.
phase 0 unit 2 week 1
boggle class challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BoggleBoard | |
def initialize (board) | |
@board=board | |
end | |
def create_word(*coords) | |
puts coords.map { |coord| @board[coord.first][coord.last]}.join("") | |
end | |
def get_row(row) | |
@board[row-1] | |
end | |
def get_col(col) | |
@board.map { |row| row[col-1]} | |
end | |
def get_diagonal (row1, col1, row2, col2) | |
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