Created
December 15, 2013 16:43
-
-
Save tarynsauer/7975151 to your computer and use it in GitHub Desktop.
This file contains 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 WebUI < UI | |
def print_active_board | |
board_string = '' | |
board.all_rows.each do |row| | |
board_string += "<div class='row'>" | |
row.each { |cell| board_string += "<button name='move' value='#{cell}'> #{board.all_cells[cell]} <span class='cell'>.</span></button>" } | |
board_string += "</div>" | |
end | |
board_string | |
end | |
def print_inactive_board | |
board_string = '' | |
board.all_rows.each do |row| | |
board_string += "<div class='row'>" | |
row.each { |cell| board_string += "<button> #{board.all_cells[cell]} <span class='cell'>.</span></button>" } | |
board_string += "</div>" | |
end | |
board_string | |
end | |
def first_move_message(player) | |
"Player '#{player.marker}' goes first." | |
end | |
def next_move_message(player) | |
"Player '#{player.marker}': Make your move." | |
end | |
def winning_game_message(player) | |
"GAME OVER! Player '#{player.marker}' wins!" | |
end | |
def tie_game_message | |
"GAME OVER! It's a tie!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment