Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/software_challenge_client/player.rb
Overview
A player, participating in a game
Instance Attribute Summary collapse
-
#coal ⇒ Integer
The player’s current coal supply.
-
#color ⇒ PlayerColor
readonly
The player’s color.
-
#direction ⇒ Direction
The player’s current direction.
-
#movement ⇒ Direction
The player’s current movement points.
-
#name ⇒ String
readonly
The player’s name.
-
#passengers ⇒ Integer
How many passengers the player’s has picked up.
-
#points ⇒ Integer
The player’s points.
-
#velocity ⇒ Integer
The player’s current velocity.
-
#x ⇒ Integer
The player’s current x-position.
-
#y ⇒ Integer
The player’s current y-position.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(color, name) ⇒ Player
constructor
Initializer.
Constructor Details
Instance Attribute Details
#coal ⇒ Integer
Returns the player’s current coal supply.
23 24 25 |
# File 'lib/software_challenge_client/player.rb', line 23 def coal @coal end |
#color ⇒ PlayerColor (readonly)
Returns the player’s color.
11 12 13 |
# File 'lib/software_challenge_client/player.rb', line 11 def color @color end |
#direction ⇒ Direction
Returns the player’s current direction.
27 28 29 |
# File 'lib/software_challenge_client/player.rb', line 27 def direction @direction end |
#movement ⇒ Direction
Returns the player’s current movement points.
39 40 41 |
# File 'lib/software_challenge_client/player.rb', line 39 def movement @movement end |
#name ⇒ String (readonly)
Returns the player’s name.
7 8 9 |
# File 'lib/software_challenge_client/player.rb', line 7 def name @name end |
#passengers ⇒ Integer
Returns how many passengers the player’s has picked up.
43 44 45 |
# File 'lib/software_challenge_client/player.rb', line 43 def passengers @passengers end |
#points ⇒ Integer
Returns the player’s points.
15 16 17 |
# File 'lib/software_challenge_client/player.rb', line 15 def points @points end |
#velocity ⇒ Integer
Returns the player’s current velocity.
19 20 21 |
# File 'lib/software_challenge_client/player.rb', line 19 def velocity @velocity end |
#x ⇒ Integer
Returns the player’s current x-position.
31 32 33 |
# File 'lib/software_challenge_client/player.rb', line 31 def x @x end |
#y ⇒ Integer
Returns the player’s current y-position.
35 36 37 |
# File 'lib/software_challenge_client/player.rb', line 35 def y @y end |
Instance Method Details
#==(other) ⇒ Object
59 60 61 |
# File 'lib/software_challenge_client/player.rb', line 59 def ==(other) color == other.color end |