Class: GooseGame::Cell::Goose
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from GooseGame::Cell::Base
Instance Method Details
#call(player, dice) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/goose_game/cell.rb', line 75 def call(player, dice) tokens = [] super.tap do |pos| while goose?(pos) pos += dice.to_i tokens << "The Goose. #{player} moves again and goes to #{pos}" end @tokens << tokens.join(", ") player.position = pos return pos end end |