Created
July 18, 2014 01:42
-
-
Save pumpkincouture/373dd2936a5a7a6db9c1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Game | |
attr_accessor :board, :comp_winning_combos, :human_winning_combos, :comp_moves, :human_moves | |
def initialize(user, computer) | |
#Initialize the variables, this will launch the game into first_turn | |
@user="O" | |
@computer="X" | |
@comp_moves=[] | |
@human_moves=[] | |
@board={"1"=>"1", "2"=>"2", "3"=>"3", "4"=>"4", "5"=>"5", | |
"6"=>"6", "7"=>"7", "8"=>"8", "9"=>"9"} | |
@comp_winning_combos=[[1,2,3], [4,5,6], [7,8,9], | |
[1,4,7], [2,5,8], [3,6,9], | |
[1,5,9], [3,5,7]] | |
@human_winning_combos=[[1,2,3], [4,5,6], [7,8,9], | |
[1,4,7], [2,5,8], [3,6,9], | |
[1,5,9], [3,5,7]] | |
first_turn | |
end | |
#more code | |
new_game=Game.new("Human", "Tic Tac Toe Warlord") | |
new_game.second_turn | |
new_game.third_turn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment