class TwentyOne::Bet

Attributes

chips[R]

Public Class Methods

new() click to toggle source
# File lib/twenty_one/bet.rb, line 8
def initialize()
        @chips = [] 
end

Public Instance Methods

clear() click to toggle source
# File lib/twenty_one/bet.rb, line 40
def clear
        @chips = []
end
payout(type) click to toggle source
# File lib/twenty_one/bet.rb, line 20
def payout(type)
        res = []

        if type == :twenty_one
                payout_generator = Player.new "Temporary player"
                
                payout_generator.make_bet value * 2.5
                
                res.concat payout_generator.bet.chips
                payout_generator = nil
        elsif type == :push
                res.concat @chips
        else
                2.times do res.concat @chips end 
        end  

        @chips = []
        res
end
present(chips) click to toggle source
# File lib/twenty_one/bet.rb, line 12
def present(chips)
        @chips = chips
end
value() click to toggle source
# File lib/twenty_one/bet.rb, line 16
def value
        Chip.get_amount(@chips)
end