require 'Deck.rb' require 'WarRules.rb' puts "Welcome to War!" puts "Before we begin let me shuffle the deck..." deck = Deck.new() rules = WarRules.new() deck.full_shuffle top_half = Array.new(deck.get_top_half) bottom_half = Array.new(deck.get_bottom_half) puts "The deck has been shuffled and split." puts "Now lets see how long the game takes to finish, and who wins!" counter = 0 until rules.game_is_over(top_half, bottom_half) or counter > 10000 rules.examine_decks(top_half, bottom_half) counter = counter + 1 end winner = rules.determine_winner(top_half, bottom_half) if( counter > 10000 ) puts "The game went into a coldwar, no one wins." else puts "After #{counter} moves, #{winner} has won!" end puts "Press ENTER to exit" gets