# igrkart1
!!by Master Set (blakarchont@gmail.com)
!!HOME GAMES
clr
minut += 5
gs 'stat'

if turn = 0:
	cla
	'<right><img src="images/casino/stavkacw.jpg"></right>'
	' Please give me your bets, gentlemen.'

	act 'Make a bet':
		money -= deal
		turn = 1
		deal = input 'Enter the amount'

		if money < deal:
			msg 'You have enough money'
			gt 'igrkart1'
		elseif deal < 0:
			msg 'Wrong, try again.'
			gt 'igrkart1'
		elseif deal > 1000:
			msg 'The maximum rate of 1000 rubles.'
			gt 'igrkart1'
		end

		gt 'igrkart1'
	end

	act 'Move away from the table':gt 'bldzh'
end

!!the cards are dealt
if turn = 1:
	cla
	'<right><img src="images/casino/cartbd.jpg"></right>'
	' The dealer deals the cards:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$d_card[1] = $number[number] + $suit[suit]
	d_points = points[number]
	suit = rand(1, 4)
	number = rand(1, 13)
	$p_card[1] = $number[number] + $suit[suit]
	p_points = points[number]
	suit = rand(1, 4)
	number = rand(1, 13)
	$p_card[2] = $number[number] + $suit[suit]
	p_points += points[number]

	if p_points = 22:
		p_points = 21
	elseif p_points < 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'

		act 'Enough':
			turn = 3
			gt 'igrkart1'
		end

		act 'Another card':
			turn = 2
			gt 'igrkart1'
		end
	elseif p_points = 21:
		prise = deal * 3
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'BLACK JACK!'

		act 'Pick up the win (<<prise>> rubles)':
			money += prise
			turn = 0
			gt 'igrkart1'
		end
	end
end

!!Additional cards
if turn = 2:
	cla
	'<right><img src="images/casino/cartbde.jpg"></right>'
	'The dealer deals one more card:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$p_card[3] = $number[number] + $suit[suit]
	p_points += points[number]

	if p_points <= 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'

		act 'Enough':
			turn = 3
			gt 'igrkart1'
		end

		act 'Another card':
			turn = 22
			gt 'igrkart1'
		end

	elseif p_points > 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'
		'Bust! You lose.'

		act '...':
			turn = 0
			gt 'igrkart1'
		end
	end
end

if turn = 22:
	cla
	'<right><img src="images/casino/cartbde.jpg"></right>'
	'The dealer deals one more card:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$p_card[4] = $number[number] + $suit[suit]
	p_points += points[number]

	if p_points <= 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'
		'  <<$p_card[4]>>'

		act 'Enough':
			turn = 3
			gt 'igrkart1'
		end

		act 'Another card':
			turn = 222
			gt 'igrkart1'
		end
	elseif p_points > 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'
		'  <<$p_card[4]>>'
		'Bust! You lose.'

		act '...':
			turn = 0
			gt 'igrkart1'
		end
	end
end

if turn = 222:
	cla
	'<right><img src="images/casino/cartbde.jpg"></right>'
	'The dealer deals one more card:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$p_card[5] = $number[number] + $suit[suit]
	p_points += points[number]

	if p_points <= 21:
		'Bank card:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'
		'  <<$p_card[4]>>'
		'  <<$p_card[5]>>'

		act 'Enough':
			turn = 3
			gt 'igrkart1'
		end
	elseif p_points > 21:
		'Map of dealer:'
		'  <<$d_card[1]>>'
		'__________________________'
		'Player Maps:'
		'  <<$p_card[1]>>'
		'  <<$p_card[2]>>'
		'  <<$p_card[3]>>'
		'  <<$p_card[4]>>'
		'  <<$p_card[5]>>'
		'Bust! You lose.'

		act '...':
			turn = 0
			gt 'igrkart1'
		end
	end
end


!!Transoms Bank''s cards
if turn = 3:
	cla
	'<right><img src="images/casino/cartbde.jpg"></right>'
	'Dealer gets cards:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$d_card[2] = $number[number] + $suit[suit]
	d_points += points[number]

	if p_points = 22:
		p_points = 21
	elseif d_points >= 17:
		'Bank cards:'
		'  <<$d_card[1]>>'
		'  <<$d_card[2]>>'
		'Points dealer:<<d_points>>'
		'__________________________'
		'Player Points <<p_points>>'
		'__________________________'

		if d_points > p_points:
			'Casinos won'

			act '...':
				turn = 0
				gt 'igrkart1'
			end
		elseif d_points = p_points:
			'Draw'

			act 'Take a bet':
				money += deal
				turn = 0
				gt 'igrkart1'
			end
		elseif d_points < p_points:
			'Player won'
			prise = deal * 2

			act 'Pick up the win (<<prise>> rubles).':
				money += prise
				turn = 0
				gt 'igrkart1'
			end
		end
	elseif d_points < 17:
		suit = rand(1, 4)
		number = rand(1, 13)
		$d_card[3] = $number[number] + $suit[suit]
		d_points += points[number]

		if d_points <= 21:
			'The dealer''s cards:'
			'  <<$d_card[1]>>'
			'  <<$d_card[2]>>'
			'  <<$d_card[3]>>'
			'Points dealer:<<d_points>>'
			'__________________________'
			'Player Points <<p_points>>'
			'__________________________'

			if d_points > p_points:
				'Casinos won'

				act '...':
					turn = 0
					gt 'igrkart1'
				end
			elseif d_points = p_points:
				'Draw'

				act 'Take a bet':
					money += deal
					turn = 0
					gt 'igrkart1'
				end
			elseif d_points < p_points:
				'Player won'
				prise = deal * 2

				act 'Pick up the win (<<prise>> rubles).':
					money += prise
					turn = 0
					gt 'igrkart1'
				end
			end
		elseif d_points > 21:
			prise = deal * 2
			'The dealer''s cards:'
			'  <<$d_card[1]>>'
			'  <<$d_card[2]>>'
			'  <<$d_card[3]>>'
			'__________________________'
			'Busting!'
			'__________________________'
			'Player won'

			act 'Pick up the win (<<prise>> rubles)':
				money += prise
				turn = 0
				gt 'igrkart1'
			end
		end
	end
end

--- igrkart1 ---------------------------------
