Skip to content

Instantly share code, notes, and snippets.

@marklocklear
Created April 30, 2013 18:53
Show Gist options
  • Save marklocklear/5491006 to your computer and use it in GitHub Desktop.
Save marklocklear/5491006 to your computer and use it in GitHub Desktop.
#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