Class: Opponent
Overview
Copyright © 2011 Jesse Sielaff
Instance Method Summary collapse
-
#cards ⇒ Object
Returns the number of Cards held by the Opponent.
-
#claimed_routes ⇒ Object
Returns an Array of the Routes claimed by the Opponent.
-
#score ⇒ Object
Returns the current score of the Opponent.
-
#selections(n) ⇒ Object
Returns an Array of the color of the last n Cards selected by the Opponent.
-
#tickets ⇒ Object
Returns the number of Tickets held by the Player.
-
#trains ⇒ Object
Returns the number of unplayed trains held by the Player.
Methods inherited from Entity
Constructor Details
This class inherits a constructor from Entity
Instance Method Details
#cards ⇒ Object
Returns the number of Cards held by the Opponent.
9 10 11 |
# File 'lib/ttr/entities/opponent.rb', line 9 def cards @obj.cards.values.flatten.length end |
#claimed_routes ⇒ Object
Returns an Array of the Routes claimed by the Opponent.
15 16 17 |
# File 'lib/ttr/entities/opponent.rb', line 15 def claimed_routes Route.entities(@obj.claimed_route_objs) end |
#score ⇒ Object
Returns the current score of the Opponent.
21 22 23 |
# File 'lib/ttr/entities/opponent.rb', line 21 def score @obj.score end |
#selections(n) ⇒ Object
Returns an Array of the color of the last n Cards selected by the Opponent. Cards drawn at random are represented as :grey.
28 29 30 |
# File 'lib/ttr/entities/opponent.rb', line 28 def selections (n) @obj.selections.first(n) end |
#tickets ⇒ Object
Returns the number of Tickets held by the Player.
34 35 36 |
# File 'lib/ttr/entities/opponent.rb', line 34 def tickets @obj.kept_ticket_objs.length end |
#trains ⇒ Object
Returns the number of unplayed trains held by the Player.
40 41 42 |
# File 'lib/ttr/entities/opponent.rb', line 40 def trains @obj.trains end |