Class: Opponent

Inherits:
Entity show all
Defined in:
lib/ttr/entities/opponent.rb

Overview

Copyright © 2011 Jesse Sielaff

Instance Method Summary collapse

Methods inherited from Entity

inherited, #initialize

Constructor Details

This class inherits a constructor from Entity

Instance Method Details

#cardsObject

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_routesObject

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

#scoreObject

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

#ticketsObject

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

#trainsObject

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