Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/software_challenge_client/player.rb
Overview
Ein Spieler
Instance Attribute Summary collapse
-
#cards ⇒ Array[CardType]
Die noch nicht gespielten Karten.
-
#carrots ⇒ Integer
Die aktuelle Anzahl Karotten des Spielers.
-
#color ⇒ PlayerColor
readonly
Die Farbe des Spielers, Rot oder Blau.
-
#index ⇒ Integer
Die aktuelle Position des Spielers auf dem Spielbrett, entspricht index des Feldes, von 0 bis 64.
-
#last_non_skip_action ⇒ Action
Letzte Aktion, die kein Skip war.
-
#must_play_card ⇒ Boolean
Zeigt an, ob eine Karte gespielt werden muss, wird in Zugvalidierung verwendet.
-
#name ⇒ String
readonly
Der Name des Spielers, hat keine Auswirkungen auf das Spiel.
-
#points ⇒ Integer
Der aktuelle Punktestand des Spielers.
-
#salads ⇒ Integer
Die aktuelle Anzahl Salate des Spielers.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(color, name) ⇒ Player
constructor
Konstruktor.
- #owns_card_of_type(card_type) ⇒ Object
Constructor Details
Instance Attribute Details
#cards ⇒ Array[CardType]
Returns die noch nicht gespielten Karten.
33 34 35 |
# File 'lib/software_challenge_client/player.rb', line 33 def cards @cards end |
#carrots ⇒ Integer
Returns die aktuelle Anzahl Karotten des Spielers.
25 26 27 |
# File 'lib/software_challenge_client/player.rb', line 25 def carrots @carrots end |
#color ⇒ PlayerColor (readonly)
Returns die Farbe des Spielers, Rot oder Blau.
12 13 14 |
# File 'lib/software_challenge_client/player.rb', line 12 def color @color end |
#index ⇒ Integer
Returns die aktuelle Position des Spielers auf dem Spielbrett, entspricht index des Feldes, von 0 bis 64.
21 22 23 |
# File 'lib/software_challenge_client/player.rb', line 21 def index @index end |
#last_non_skip_action ⇒ Action
Returns letzte Aktion, die kein Skip war.
37 38 39 |
# File 'lib/software_challenge_client/player.rb', line 37 def last_non_skip_action @last_non_skip_action end |
#must_play_card ⇒ Boolean
Returns zeigt an, ob eine Karte gespielt werden muss, wird in Zugvalidierung verwendet.
41 42 43 |
# File 'lib/software_challenge_client/player.rb', line 41 def must_play_card @must_play_card end |
#name ⇒ String (readonly)
Returns der Name des Spielers, hat keine Auswirkungen auf das Spiel.
8 9 10 |
# File 'lib/software_challenge_client/player.rb', line 8 def name @name end |
#points ⇒ Integer
Returns der aktuelle Punktestand des Spielers.
16 17 18 |
# File 'lib/software_challenge_client/player.rb', line 16 def points @points end |
#salads ⇒ Integer
Returns die aktuelle Anzahl Salate des Spielers.
29 30 31 |
# File 'lib/software_challenge_client/player.rb', line 29 def salads @salads end |
Instance Method Details
#==(other) ⇒ Object
56 57 58 |
# File 'lib/software_challenge_client/player.rb', line 56 def ==(other) color == other.color end |
#owns_card_of_type(card_type) ⇒ Object
60 61 62 |
# File 'lib/software_challenge_client/player.rb', line 60 def owns_card_of_type(card_type) cards.include? card_type end |