# igrkart2
clr
gs 'stat'
set minut += 5

if turn1 = 0:
	CLA
	'<right><img src="images\casino\stavkacw.jpg"></right>'
	' Please give me your bets, gentlemen.'
	ACT 'IPod':
		deal = input 'Enter the amount'
		if money < deal:
			msg 'You have enough money'
			gt 'igrkart2'
		end
		if deal < 0:
			msg 'Wrong, try again.'
			gt 'igrkart1'
		end
		if deal > 1000:
			msg 'The maximum rate of 1000 rubles.'
			gt 'igrkart1'
		end
		set money -= deal
		turn1 = 1
		GT 'igrkart2'
	END
	ACT 'Move away from the table':
		GT 'kazvar'
	END
end

if turn1 = 1:
	CLA
	'<right><img src="images\casino\stavkacw.jpg"></right>'
	nich = 0
	ACT 'Put another draw':
		if money < deal:
			msg 'You have enough money'
			turn1 = 2
			nich = 0
			gt 'igrkart2'
		end
		set money -= deal
		turn1 = 2
		nich = 1
		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
	end
	if di_poi < pl_poi:
		' '
		'You won'
		act 'You have won <<2*deal>> rub.':
			set money += 2 * deal
			turn1 = 0
			gt 'igrkart2'
		end
	end
	if di_poi = pl_poi:
		if nich = 1:
			' '
			'You won'
			act 'You have won <<11*deal>> rub.':
				set money += 11 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		else
			turn1 = 3
			gt 'igrkart2'
		end
	end
end

if turn1 = 3:
	act 'Continue to play':
		if money < deal:
			msg 'You have enough money'
			gt 'igrkart2'
		end
		set money -= deal
		CLA
		'<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
		wait 1000
		'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
		end
		if di_poi < pl_poi:
			' '
			'You won'
			act 'You have won <<4*deal>> rub.':
				set money += 4 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		end
		if di_poi = pl_poi:
			' '
			'Again draw'
			act 'Pick up <<3*deal>> rub.':
				set money += 3 * deal
				turn1 = 0
				gt 'igrkart2'
			end
		end
	end
	act 'Pick up half your bet':
		if deal mod 2 = 1:
			deal = deal + 1
		end
		set money += deal/2
		gt 'igrkart2'
	end
end
--- igrkart2 ---------------------------------

