# igrkart2
clr
minut += 5
gs 'stat'

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

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

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

		gt 'igrkart2'
	end

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

if turn1 = 1:
	cla
	nich = 0
	'<right><img src="images/casino/stavkacw.jpg"></right>'

	act 'Put another draw':
		turn1 = 2
		nich = 1

		if money < deal:
			msg 'You have enough money'
			turn1 = 2
			nich = 0
			gt 'igrkart2'
		else
			money -= deal
		end

		gt 'igrkart2'
	end

	act 'Continue without an additional rate':
		turn1 = 2
		nich = 0
		gt 'igrkart2'
	end
end

if turn1 = 2:
	cla
	'<right><img src="images/casino/cartcw.jpg"></right>'
	' The dealer deals the cards:'
	'...'
	suit = rand(1, 4)
	number = rand(1, 13)
	$di_card[1] = $number[number] + $suit[suit]
	di_points = points[number]
	di_poi = number
	suit = rand(1, 4)
	number = rand(2, 14)
	$pl_card[1] = $number[number] + $suit[suit]
	pl_points = points[number]
	pl_poi = number
	wait 1000
	'Map of dealer:'
	'  <<$di_card[1]>>'

	'__________________________'
	'Player Maps:'

	'  <<$pl_card[1]>>'

	if di_poi > pl_poi:
		' '
		'Casinos won'

		act 'You lost':
			turn1 = 0
			gt 'igrkart2'
		end
	elseif di_poi < pl_poi:
		' '
		'You won'
		act 'You have won (<<2 * deal>> rubles)':
			money += 2 * deal
			turn1 = 0
			gt 'igrkart2'
		end
	elseif di_poi = pl_poi:
		if nich = 1:
			' '
			'You won'

			act 'You have won (<<11 * deal>> rubles)':
				money += 11 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		else
			turn1 = 3
			gt 'igrkart2'
		end
	end
end

if turn1 = 3:
	act 'Continue to play':
		cla

		if money < deal:
			msg 'You have enough money'
			gt 'igrkart2'
		else
			money -= deal
		end

		'<right><img src="images/casino/cartcw.jpg"></right>'
		' The dealer deals the cards:'
		'...'
		suit = rand(1, 4)
		number = rand(1, 13)
		$di_card[2] = $number[number] + $suit[suit]
		di_points = points[number]
		di_poi = number
		suit = rand(1, 4)
		number = rand(2, 14)
		$pl_card[2] = $number[number] + $suit[suit]
		pl_points = points[number]
		pl_poi = number
		'Map of dealer:'
		'  <<$di_card[1]>>'
		'  <<$di_card[2]>>'
		'__________________________'
		'Player Maps:'
		'  <<$pl_card[1]>>'
		'  <<$pl_card[2]>>'

		if di_poi > pl_poi:
			' '
			'Casinos won'

			act 'You lost':
				turn1 = 0
				gt 'igrkart2'
			end
		elseif di_poi < pl_poi:
			' '
			'You won'

			act 'You have won (<<4 * deal>> rubles)':
				money += 4 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		elseif di_poi = pl_poi:
			' '
			'Again draw'

			act 'Pick up (<<3 * deal>> rubles)':
				money += 3 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		end
	end

	act 'Pick up half your bet':
		if deal mod 2 = 1:deal += 1

		money += deal / 2
		gt 'igrkart2'
	end
end

--- igrkart2 ---------------------------------
