Instantly share code, notes, and snippets.

Embed
What would you like to do?
#main.rb
require "./include.rb"
@board = Array.new
@board = {'ul' => 'ul', 'um' => 'um', 'ur' => 'ur',
'ml' => 'ml', 'mm' => 'mm', 'mr' => 'mr',
'll' => 'll', 'lm' => 'lm', 'lr' => 'lr'}
puts "Enter a move in the following sequence\n
ul um ur\n
ml mm mr\n
ll lm lr\n"
@active = true
while @active do
print "Player(X) #1 Enter move:"
var = gets.chomp
@board[var] = 'X'
check_for_winner
show_board
print "Player(O) #2 Enter move:"
var = gets.chomp
@board[var] = 'O'
check_for_winner
show_board
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment