Sha256: f8eee2be3370dc2d57f6f7e6d3aa86007a51ac6431508e94aab9709db9554c99

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

require "twenty_one/chip"
require "twenty_one/player"

module TwentyOne
	class Bet
		attr_reader :chips

		def initialize()
			@chips = [] 
		end

		def present(chips)
			@chips = chips
		end

		def value
			Chip.get_amount(@chips)
		end

		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

		def clear
			@chips = []
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twenty_one-0.1.1 lib/twenty_one/bet.rb
twenty_one-0.1.0 lib/twenty_one/bet.rb