Sha256: 21489e6134b2d8e956c507780f6f7eb174695e407a730788e77c8e9bfb1f3b51

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

#!/usr/bin/env ruby

require 'tic-tac-toe'

board = Board.new
player_one = Player.new('X')
player_two = Player.new('O')

until board.game_over?
  puts board
  print "Make a move, player 1 (1-9): "
  position = gets
  player_one.make_move(board, position)
  break if board.game_over?
  puts board
  print "Make a move, player 2 (1-9): "
  position = gets
  player_two.make_move(board, position)
end

puts board
winner = board.get_winner
if winner
  puts "#{winner} Won!"
else
  puts "Tie game!"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tic-tac-toe-1.1.0 bin/tic-tac-toe
tic-tac-toe-1.0.0 bin/tic-tac-toe