Class: Condition
- Inherits:
-
Object
- Object
- Condition
- Defined in:
- lib/software_challenge_client/condition.rb
Overview
Das Ergebnis eines Spieles. Ist im ‘GameState#condition` zu finden, wenn das Spiel beendet wurde.
Instance Attribute Summary collapse
-
#reason ⇒ String
readonly
Grund fuer Spielende.
-
#winner ⇒ Player
readonly
Spieler, der das Spiel gewonnen hat.
Instance Method Summary collapse
-
#draw? ⇒ Boolean
Überprüfe ob es ein Unentschieden gab.
-
#initialize(winner, reason) ⇒ Condition
constructor
Initializes the winning Condition with a player.
Constructor Details
#initialize(winner, reason) ⇒ Condition
Initializes the winning Condition with a player
18 19 20 21 |
# File 'lib/software_challenge_client/condition.rb', line 18 def initialize(winner, reason) @winner = winner @reason = reason end |
Instance Attribute Details
#reason ⇒ String (readonly)
Returns Grund fuer Spielende.
13 14 15 |
# File 'lib/software_challenge_client/condition.rb', line 13 def reason @reason end |
#winner ⇒ Player (readonly)
Returns Spieler, der das Spiel gewonnen hat.
9 10 11 |
# File 'lib/software_challenge_client/condition.rb', line 9 def winner @winner end |
Instance Method Details
#draw? ⇒ Boolean
Überprüfe ob es ein Unentschieden gab
24 25 26 |
# File 'lib/software_challenge_client/condition.rb', line 24 def draw? @winner.nil? end |