Class: TexasHoldem::Game
- Inherits:
-
Object
- Object
- TexasHoldem::Game
- Defined in:
- lib/game.rb
Constant Summary collapse
- SMALL_BLIND_PERCENTAGE =
0.0125
Instance Attribute Summary collapse
-
#entrance_fee ⇒ Object
readonly
Returns the value of attribute entrance_fee.
-
#players ⇒ Object
readonly
Returns the value of attribute players.
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize(players, entrance_fee) ⇒ Game
constructor
A new instance of Game.
- #small_blind ⇒ Object
- #winner ⇒ Object
Constructor Details
#initialize(players, entrance_fee) ⇒ Game
Returns a new instance of Game.
5 6 7 |
# File 'lib/game.rb', line 5 def initialize(players,entrance_fee) @players, @entrance_fee = players, entrance_fee end |
Instance Attribute Details
#entrance_fee ⇒ Object (readonly)
Returns the value of attribute entrance_fee.
3 4 5 |
# File 'lib/game.rb', line 3 def entrance_fee @entrance_fee end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
3 4 5 |
# File 'lib/game.rb', line 3 def players @players end |
Instance Method Details
#finished? ⇒ Boolean
9 10 11 |
# File 'lib/game.rb', line 9 def finished? players.size == 1 end |
#small_blind ⇒ Object
17 18 19 |
# File 'lib/game.rb', line 17 def small_blind @entrance_fee * SMALL_BLIND_PERCENTAGE end |
#winner ⇒ Object
13 14 15 |
# File 'lib/game.rb', line 13 def winner players.first if finished? end |