aboutsummaryrefslogtreecommitdiffstats
path: root/main.rb
diff options
context:
space:
mode:
Diffstat (limited to 'main.rb')
-rw-r--r--main.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/main.rb b/main.rb
index 4a3c10f..eea663c 100644
--- a/main.rb
+++ b/main.rb
@@ -5,8 +5,9 @@ board = Board.new
player_1 = Player.new(Player::INSIGNIAS[:x], board)
player_2 = Player.new(Player::INSIGNIAS[:o], board)
board.current_player = player_1
+winner = nil
-until board.winner?
+until winner
puts board.render
puts
@@ -19,4 +20,12 @@ until board.winner?
board.current_player.move(coordinates)
board.current_player = board.current_player == player_1 ? player_2 : player_1
+
+ puts '----'
+
+ winner = board.winner?
+ if winner
+ puts board.render
+ puts "Player #{winner} wins"
+ end
end