Class: WebBoard
Instance Attribute Summary
Attributes inherited from Board
#all_cells, #num_of_rows, #winning_lines
Instance Method Summary collapse
Methods inherited from Board
#add_test_marker, #all_rows, #available_cell?, #create_board_hash, #empty?, #game_over?, #get_winning_lines, #initialize, #moves_remaining?, #open_cells, #random_cell, #remove_marker, #valid_cell?, #winner?
Constructor Details
This class inherits a constructor from Board
Instance Method Details
#print_active_board ⇒ Object
200 201 202 203 204 205 206 207 208 |
# File 'lib/board.rb', line 200 def print_active_board board_string = '' all_rows.each do |row| board_string += "<div class='row'>" row.each { |cell| board_string += "<button name='move' value='#{cell}'> #{all_cells[cell]} <span class='cell'>.</span></button>" } board_string += "</div>" end board_string end |
#print_inactive_board ⇒ Object
210 211 212 213 214 215 216 217 218 |
# File 'lib/board.rb', line 210 def print_inactive_board board_string = '' all_rows.each do |row| board_string += "<div class='row'>" row.each { |cell| board_string += "<button> #{all_cells[cell]} <span class='cell'>.</span></button>" } board_string += "</div>" end board_string end |