Class: PrisonerPuzzle
- Inherits:
-
Object
- Object
- PrisonerPuzzle
- Defined in:
- lib/prisoner_puzzle.rb
Instance Method Summary collapse
-
#initialize ⇒ PrisonerPuzzle
constructor
A new instance of PrisonerPuzzle.
- #run ⇒ Object
Constructor Details
#initialize ⇒ PrisonerPuzzle
6 7 8 9 10 11 12 13 |
# File 'lib/prisoner_puzzle.rb', line 6 def initialize box = Switchbox.new prisoners = [] 23.times { prisoners.push(Prisoner.new(box, 23))} @warden_gentles = Warden.new(prisoners) prisoners[1].leader = true prisoners.each {|p| p.warden = @warden_gentles} end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 |
# File 'lib/prisoner_puzzle.rb', line 15 def run while not @warden_gentles.done @warden_gentles.take_into_room end puts "That took a total of #{@warden_gentles.hours_elapsed/24} days." end |