Class: Game
- Inherits:
-
Object
- Object
- Game
- Defined in:
- lib/were_wolf/game.rb
Overview
game = Game.new(3, 9) game.simulate
Constant Summary collapse
- DRAW =
0- WOLF =
1- VILLAGER =
2
Instance Method Summary collapse
-
#initialize(no_of_wolves, no_of_villagers) ⇒ Game
constructor
A new instance of Game.
- #run ⇒ Object
Constructor Details
#initialize(no_of_wolves, no_of_villagers) ⇒ Game
Returns a new instance of Game.
10 11 12 |
# File 'lib/were_wolf/game.rb', line 10 def initialize(no_of_wolves, no_of_villagers) @players = PlayerCollection.new(no_of_wolves, no_of_villagers) end |
Instance Method Details
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/were_wolf/game.rb', line 14 def run until over? night_mode day_mode unless over? end return DRAW if @draw return villagers_alive.empty? ? WOLF : VILLAGER end |