Class: Game

Inherits:
Object
  • Object
show all
Defined in:
lib/rock_paper_scissors_cli/game.rb

Constant Summary collapse

QUIT_CMDS =
['q', 'quit', 'exit','n','no']
PLAY_CMDS =
['yes', 'y']

Instance Method Summary collapse

Constructor Details

#initializeGame

Returns a new instance of Game.



7
8
9
# File 'lib/rock_paper_scissors_cli/game.rb', line 7

def initialize()
	@computer = Computer.new()
end

Instance Method Details

#display_rulesObject



21
22
23
# File 'lib/rock_paper_scissors_cli/game.rb', line 21

def display_rules
	"Lets play Rock, Paper, Scissors! Rules are simple. You are playing against the a Computer object. Your objective is to select 1-of-3 weapons to use against the Compuer. To quit at anytime type q, quit, exit."
end

#playObject



11
12
13
14
15
16
17
18
19
# File 'lib/rock_paper_scissors_cli/game.rb', line 11

def play
	begin
		display_rules
		name = get_username
		@player = Player.new(name)
		run
	end
	puts "Thanks for playing!"
end