Class: RockPaperScissors::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/rock_paper_scissors/game_manager.rb

Instance Method Summary collapse

Constructor Details

#initializeGame

Returns a new instance of Game.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rock_paper_scissors/game_manager.rb', line 6

def initialize
  welcome_message

  # Instantiate board based on game mode
  mode = select_mode
  @board = Board.new(mode)

  num_players = select_player_mode
  initialize_players(num_players)

  puts "\n(Remember to begin play by entering game.play)"
end

Instance Method Details

#playObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/rock_paper_scissors/game_manager.rb', line 19

def play
  loop do
    @player1.select_move
    @player2.select_move

    break if winner
  end

  play unless quit?
end