sync on : sync rate 200 : autocam off
cls
ink rgb(255,255,255),0 : box 60,110,240,390 : ink rgb(255,0,0),0 : box 360,110,540,390
get image 1,50,100,250,400
get image 2,350,100,550,400
cls
ink rgb(255,0,0),0:box 2,400,638,478:ink rgb(255,255,255),0:box 6,403,106,475:box 140,403,240,475:box 274,403,374,475:box 407,403,509,475:ink rgb(128,0,0),0:box 7,404,105,474:box 141,404,239,474:box 275,404,373,474:box 408,404,508,474
ink rgb(255,255,255),0:center text 54,434,"Fold":center text 190,434,"Call":center text 326,434,"Raise":center text 457,434,"Quit":center text 538,434,"Cash:"
get image 3,1,399,639,479
cls
ink rgb(0,0,255),0:box 1,1,638,120:ink rgb(255,255,255),0:for t=1 to 100:dot rnd(637)+1,rnd(119)+1:next t:ink rgb(0,0,128),0:box 1,121,638,240:ink rgb(128,128,128),0:for t=1 to 100:dot rnd(637)+1,rnd(119)+122:next t:ink rgb(200,200,100),0
box 1,241,638,478:ink 0,0:for t=1 to 100:dot rnd(637)+1,rnd(236)+242:next t
get image 4,1,1,639,479
make object cylinder 1,100
make object cylinder 2,25
make object cylinder 3,25
make object cylinder 4,25
make object cylinder 5,25
position object 2,25,-20,25
position object 3,-25,-20,25
position object 4,-25,-20,-25
position object 5,25,-20,-25
scale object 2,20,140,20
scale object 3,20,140,20
scale object 4,20,140,20
scale object 5,20,140,20
scale object 1,100,5,100
for t=1 to 5 : color object t,rgb(50,50,0) : next t
make object plain 6,13,2
lock object on 6
texture object 6,3
position object 6,0,-4,8
make object plain 7,1000,1000
position object 7,0,-100,300
texture object 7,4
for t=11 to 12 : make object box t,10,15,0 : texture object t,2 : position object 11,-15,60,-125 : next t : position object 12,15,60,-125
for t=21 to 22 : make object box t,10,15,0 : texture object t,2 : position object 21,-15,60,30 : next t : position object 22,15,60,30
for t=31 to 33 : make object box t,10,15,0 : texture object t,2 : position object 31,-30,10,-20 : next t : position object 32,-15,10,-20 : position object 33,0,10,-20
position camera 0,75,-150
point camera 0,0,0
blind=rnd(1)+1
cash=200
ocash=200
 
 
 
gamestart:
if object exist(34)=1 then delete object 34
if object exist(35)=1 then delete object 35
cashd=0
ocashd=0
b=0
blind=blind+1
if blind=3 then blind=1
turn=blind+1
if turn=3 then turn=1
repeat
ink rgb(128,128,128),0
text 568,437,str$(cash)
center text 320,40,"Opponent's"
center text 320,60,"Cash:"
center text 320,80,str$(ocash)
pot=cashd+ocashd
if p31=1 or p32=1 or p33=1
else
	center text 320,200,"Pot"
	center text 320,270,str$(pot)
endif
yrot=yrot-2
if yrot<2 then yrot=0
for t=11 to 12
	if yrot=90
		texture object t+20,2
		texture object 33,2
	endif
	if yrot=70
		texture object 11,2
	endif
	if yrot=130
		texture object 12,2
	endif
	yrotate object t,yrot
	yrotate object t+20,yrot
	yrotate object 33,yrot
next t
sync
until yrot=0
do
gosub gamebegin
gosub flopbet
gosub 2drop
gosub 2dropbet
gosub 3drop
gosub 3dropbet
sync
loop
 
 
 
gamebegin:
flop=1
do
if yrot=180
gosub flopbet
else
	yrot=yrot+2
endif
for t=11 to 12
	if yrot=90
		texture object t+20,1
		texture object 33,1
		c31=rnd(12)+1 : c32=rnd(12)+1 : c33=rnd(12)+1
		s31=rnd(3)+1 : s32=rnd(3)+1 : s33=rnd(3)+1
	endif
	if yrot=70
		texture object 11,1
		c11=rnd(12)+1
		s11=rnd(3)+1
	endif
	if yrot=130
		texture object 12,1
		c12=rnd(12)+1
		s12=rnd(3)+1
	endif
	yrotate object t,yrot
	yrotate object t+20,yrot
	yrotate object 33,yrot
next t
gosub lose
gosub clicks
gosub money
gosub text
sync
loop
 
 
 
flopbet:
do
gosub chance1
gosub lose
if movement=0
	gosub turn
endif
gosub ai
gosub clicks
if call=1 or ocall=1 then gosub 2drop
gosub money
gosub text
sync
loop
 
 
 
2drop:
2drop=1
make object box 34,10,15,0 : texture object 34,2 : position object 34,15,10,-20
yrot=0
do
if yrot=180
gosub 2dropbet
else
	yrot=yrot+2
endif
if yrot=90
	texture object 34,1
	c34=rnd(12)+1
	s34=rnd(3)+1
endif
gosub lose
gosub clicks
gosub money
gosub text
sync
loop
 
 
 
2dropbet:
do
gosub chance2
gosub lose
if movement=0
	gosub turn
endif
gosub ai
gosub clicks
if call=1 or ocall=1 then gosub 3drop
gosub money
gosub text
sync
loop
 
 
 
3drop:
3drop=1
make object box 35,10,15,0 : texture object 35,2 : position object 35,30,10,-20
yrot=0
do
if yrot=180
gosub 3dropbet
else
	yrot=yrot+2
endif
if yrot=90
	texture object 35,1
	c35=rnd(12)+1
	s35=rnd(3)+1
endif
gosub lose
gosub clicks
gosub money
gosub text
sync
loop
 
 
 
3dropbet:
do
gosub chance2
gosub lose
if movement=0
	gosub turn
endif
gosub ai
gosub clicks
if call=1 or ocall=1 then gosub gamestart
gosub money
gosub text
sync
loop
 
 
 
function cards(suite,sx,sy,card,x1,x2,y1,y2)
if suite=1
	ink 0,0
	center text sx,sy,"Spades"
endif
if suite=2
	ink 0,0
	center text sx,sy,"Clubs"
endif
if suite=3
	ink rgb(255,0,0),0
	center text sx,sy,"Hearts"
endif
if suite=4
	ink rgb(255,0,0),0
	center text sx,sy,"Diamonds"
endif
if card>1 and card<11
	center text x1,y1,str$(card)
	center text x2,y2,str$(card)
endif
if card=1
	center text x1,y1,"A"
	center text x2,y2,"A"
endif
if card=11
	center text x1,y1,"J"
	center text x2,y2,"J"
endif
if card=12
	center text x1,y1,"Q"
	center text x2,y2,"Q"
endif
if card=13
	center text x1,y1,"K"
	center text x2,y2,"K"
endif
endfunction
 
 
 
text:
if yrot>=70 then cards(s11,530,260,c11,590,480,190,320)
if yrot>=130 then cards(s12,110,260,c12,50,160,190,320)
if flop=1
	if p31=1
		cards(s31,320,260,c31,380,270,190,320)
	else
		if s31=1
			ink 0,0
			center text 238,240,"S"
		endif
		if s31=2
			ink 0,0
			center text 238,240,"C"
		endif
		if s31=3
			ink rgb(255,0,0),0
			center text 238,240,"H"
		endif
		if s31=4
			ink rgb(255,0,0),0
			center text 238,240,"D"
		endif
		if c31>1 and c31<11
			center text 238,221,str$(c31)
		else
			if c31=1 then center text 238,221,"A"
			if c31=11 then center text 238,221,"J"
			if c31=12 then center text 238,221,"Q"
			if c31=13 then center text 238,221,"K"
		endif
	endif
	if p32=1
		cards(s32,320,260,c32,380,270,190,320)
	else
		if p33=1 or p31=1 or p34=1 or p35=1
		else
			if s32=1
				ink 0,0
				center text 280,240,"S"
			endif
			if s32=2
				ink 0,0
				center text 280,240,"C"
			endif
			if s32=3
				ink rgb(255,0,0),0
				center text 280,240,"H"
			endif
			if s32=4
				ink rgb(255,0,0),0
				center text 280,240,"D"
			endif
			if c32>1 and c32<11
				center text 280,221,str$(c32)
			else
				if c32=1 then center text 280,221,"A"
				if c32=11 then center text 280,221,"J"
				if c32=12 then center text 280,221,"Q"
				if c32=13 then center text 280,221,"K"
			endif
		endif
	endif
	if p33=1
	cards(s33,320,260,c33,380,270,190,320)
	else
		if p32=1 or p31=1 or p34=1 or p35=1
		else
			if s33=1
				ink 0,0
				center text 320,240,"S"
			endif
			if s33=2
				ink 0,0
				center text 320,240,"C"
			endif
			if s33=3
				ink rgb(255,0,0),0
				center text 320,240,"H"
			endif
			if s33=4
				ink rgb(255,0,0),0
				center text 320,240,"D"
			endif
			if c33>1 and c33<11
				center text 320,221,str$(c33)
			else
				if c33=1 then center text 320,221,"A"
				if c33=11 then center text 320,221,"J"
				if c33=12 then center text 320,221,"Q"
				if c33=13 then center text 320,221,"K"
			endif
		endif
	endif
endif
if 2drop=1
	if p34=1
		cards(s34,320,260,c34,380,270,190,320)
	else
		if p32=1 or p31=1 or p33=1 or p35=1
		else
			if s34=1
				ink 0,0
				center text 360,240,"S"
			endif
			if s34=2
				ink 0,0
				center text 360,240,"C"
			endif
			if s34=3
				ink rgb(255,0,0),0
				center text 360,240,"H"
			endif
			if s34=4
				ink rgb(255,0,0),0
				center text 360,240,"D"
			endif
			if c34>1 and c34<11
				center text 360,221,str$(c34)
			else
				if c34=1 then center text 360,221,"A"
				if c34=11 then center text 360,221,"J"
				if c34=12 then center text 360,221,"Q"
				if c34=13 then center text 360,221,"K"
			endif
		endif
	endif
endif
if 3drop=1
	if p35=1
		cards(s35,320,260,c35,380,270,190,320)
	else
		if s35=1
			ink 0,0
			center text 402,240,"S"
		endif
		if s35=2
			ink 0,0
			center text 402,240,"C"
		endif
		if s35=3
			ink rgb(255,0,0),0
			center text 402,240,"H"
		endif
		if s35=4
			ink rgb(255,0,0),0
			center text 402,240,"D"
		endif
		if c35>1 and c35<11
			center text 402,221,str$(c35)
		else
			if c35=1 then center text 402,221,"A"
			if c35=11 then center text 402,221,"J"
			if c35=12 then center text 402,221,"Q"
			if c35=13 then center text 402,221,"K"
		endif
	endif
endif
ink rgb(128,128,128),0
text 568,437,str$(cash)
center text 320,40,"Opponent's"
center text 320,60,"Cash:"
center text 320,80,str$(ocash)
pot=cashd+ocashd
if p31=1 or p32=1 or p33=1 or p34=1 or p35=1
else
	center text 320,200,"Pot"
	center text 320,270,str$(pot)
endif
return
 
 
 
clicks:
if turn=1
	if mx>0 and my>396 and mx<103 and my<479
		if mouseclick()=1
			fold=1
			movement=0
		endif
	endif
	if mx>138 and my>396 and mx<240 and my<479	
		if mouseclick()=1
			call=1
			movement=0
		endif
	endif
	if mx>274 and my>396 and mx<376 and my<479
		if mouseclick()=1
			raise=1
			input "";raised
			movement=0
		endif
	endif
endif
if mx>410 and my>396 and mx<514 and my<479
	if mouseclick()=1
		end
	endif
endif
mx=mousex()
my=mousey()
 
if mousex()>object screen x(31)-15 and mousex()<object screen x(31)+15 and mousey()>object screen y(31)-15 and mousey()<object screen y(31)+15
	if mouseclick()=1
		p31=p31+1
		if p31=3 then p31=1
		if p31=1
			position object 31,0,60,-125
		else
			position object 31,-30,10,-20
		endif
	endif
endif
if mousex()>object screen x(32)-15 and mousex()<object screen x(32)+15 and mousey()>object screen y(32)-15 and mousey()<object screen y(32)+15
	if mouseclick()=1
		p32=p32+1
		if p32=3 then p32=1
		if p32=1
			position object 32,0,60,-125
		else
			position object 32,-15,10,-20
		endif
	endif
endif
if mousex()>object screen x(33)-15 and mousex()<object screen x(33)+15 and mousey()>object screen y(33)-15 and mousey()<object screen y(33)+15
	if mouseclick()=1
		p33=p33+1
		if p33=3 then p33=1
		if p33=1
			position object 33,0,60,-125
		else
			position object 33,0,10,-20
		endif
	endif
endif
if object exist(34)=1
	if mousex()>object screen x(34)-15 and mousex()<object screen x(34)+15 and mousey()>object screen y(34)-15 and mousey()<object screen y(34)+15
		if mouseclick()=1
			p34=p34+1
			if p34=3 then p34=1
			if p34=1
				position object 34,0,60,-125
			else
				position object 34,15,10,-20
			endif
		endif
	endif
endif
if object exist(35)=1
	if mousex()>object screen x(35)-15 and mousex()<object screen x(35)+15 and mousey()>object screen y(35)-15 and mousey()<object screen y(35)+15
		if mouseclick()=1
			p35=p35+1
			if p35=3 then p35=1
			if p35=1
				position object 35,0,60,-125
			else
				position object 35,30,10,-20
			endif
		endif
	endif
endif
return
 
 
 
money:
if b=0
	if blind=1
		cashd=5
		cash=cash-cashd
	endif
	if blind=2
		ocashd=5
		ocash=ocash-ocashd
	endif
	b=1
endif
if raise=1
	if raised>cash then raised=cash
	cashd=cashd+raised
	cash=cash-raised
	raised=0
endif
if oraise=1
	if oraised>ocash then oraised=ocash
	ocashd=ocashd+oraised
	ocash=ocash-oraised
	oraised=0
endif
if call=1
	if cashd=0 and pot<6
		called=pot
	else
		called=oraised
	endif
	if called>cash then called=cash
	cashd=cashd+called
	cash=cash-called
	call=0
endif
if ocall=1
	if ocashd=0 and pot<6
		ocalled=pot
	else
		ocalled=raised
	endif
	if ocalled>ocash then ocalled=ocash
	ocashd=ocashd+ocalled
	ocash=ocash-ocalled
	ocall=0
endif
if fold=1
	ocash=ocash+pot
	fold=2
endif
if ofold=1
	cash=cash+pot
	ofold=2
endif
return
 
 
 
lose:
if fold=2
	fold=0
	gosub gamestart
endif
if ofold=2
	ofold=0
	gosub gamestart
endif
return
 
 
 
ai:
if turn=2
	if chance<2 and raised>0
		ofold=1
		movement=0
	endif
	if chance<15 and raised>50
		ofold=1
		movement=0
	endif
	if chance<20 and raised>75
		ofold=1
		movement=0
	endif
	if chance<35 and raised>100
		ofold=1
		movement=0
	endif
	if chance>10 and raised<0
		oraised=chance+50
		movement=0
	endif
	if chance>20 and raised<0
		oraised=chance+75
		movement=0
	endif
	if chance>35 and raised<0
		oraised=chance+100
		movement=0
	endif
	if chance>35 and raised<50
		oraise=1
		movement=0
	endif
	if chance>10 and raised<0
		oraise=1
		movement=0
	endif
	if chance>20 and raised<0
		oraise=1
		movement=0
	endif
	if chance>35 and raised<0
		oraise=1
		movement=0
	endif
	if chance>35 and raised<50
		oraised=raised+25
		movement=0
	endif
	if chance<20 and raised<50
		ocall=1
		movement=0
	endif
	if chance<10 and raised<25
		ocall=1
		movement=0
	endif
endif
return
 
 
 
Matches:
if c31=c32 or c31=c33 or c32=c33 then pairs=1
if c11=c12 or c11=c31 or c11=c32 or c11=c33 or c12=c31 or c12=c32 or c12=c33 then mpairs=1
if c21=c22 or c21=c31 or c21=c32 or c21=c33 or c22=c31 or c22=c32 or c22=c33 then opairs=1
if c11=c12 and c31=c32 or c11=c12 and c31=c33 or c11=c12 and c32=c33 or c11=c31 and c12=c32 or c11=c31 and c12=c33 or c11=c31 and c32=c33 then mtwopairs=1
if c11=c32 and c12=c31 or c11=c32 and c12=c33 or c11=c32 and c31=c32 or c11=c33 and c12=c31 or c11=c33 and c12=c32 or c11=c33 and c31=c32 then mtwopairs=1
if c12=c31 and c32=c33 or c12=c32 and c31=c33 or c12=c33 and c31=c32 then mtwopairs=1 
if c21=c22 and c31=c32 or c21=c22 and c31=c33 or c21=c22 and c32=c33 or c21=c31 and c22=c32 or c21=c31 and c22=c33 or c21=c31 and c32=c33 then otwopairs=1
if c21=c32 and c22=c31 or c21=c32 and c22=c33 or c21=c32 and c31=c32 or c21=c33 and c22=c31 or c21=c33 and c22=c32 or c21=c33 and c31=c32 then otwopairs=1
if c22=c31 and c32=c33 or c22=c32 and c31=c33 or c22=c33 and c31=c32 then otwopairs=1 
if c31=c32 and c32=c33 then threeofakind=1
if c11=c12 and c12=c31 or c11=c12 and c12=c32 or c11=c12 and c12=c33 or c11=c31 and c31=c32 or c11=c31 and c31=c33 or c11=c32 and c32=c33 then mthreeofakind=1
if c12=c31 and c31=c32 or c12=c31 and c31=c33 or c12=c32 and c32=c33 then mthreeofakind=1
if c21=c22 and c22=c31 or c21=c22 and c22=c32 or c21=c22 and c22=c33 or c21=c31 and c31=c32 or c21=c31 and c31=c33 or c21=c32 and c32=c33 then othreeofakind=1
if c22=c31 and c31=c32 or c22=c31 and c31=c33 or c22=c32 and c32=c33 then othreeofakind=1
if c11=c12 and c12=c31 and c31=c32 or c11=c12 and c12=c31 and c31=c33 or c12=c31 and c31=c32 and c32=c33 then mfourofakind=1
if c21=c22 and c22=c31 and c31=c32 or c21=c22 and c22=c31 and c31=c33 or c22=c31 and c31=c32 and c32=c33 then ofourofakind=1
if c11=c12 and c31=c32 and c32=c33 or c11=c31 and c12=c32 and c32=c33 or c11=c32 and c12=c31 and c31=c33 or c11=c33 and c12=c32 and c32=c33 then mfullhouse=1
if c12=c31 and c11=c32 and c32=c33 or c12=c32 and c11=c31 and c31=c33 or c12=c33 and c11=c31 and c31=c32 or c31=c32 and c11=c12 and c12=c33 then mfullhouse=1
if c31=c33 and c11=c12 and c12=c32 or c32=c33 and c11=c12 and c12=c31 then mfullhouse=1
if c21=c22 and c31=c32 and c32=c33 or c21=c31 and c22=c32 and c32=c33 or c21=c32 and c22=c31 and c31=c33 or c21=c33 and c22=c32 and c32=c33 then ofullhouse=1
if c22=c31 and c21=c32 and c32=c33 or c22=c32 and c21=c31 and c31=c33 or c22=c33 and c21=c31 and c31=c32 or c31=c32 and c21=c22 and c22=c33 then ofullhouse=1
if c31=c33 and c21=c22 and c22=c32 or c32=c33 and c21=c12 and c22=c31 then ofullhouse=1
for a=1 to 7
	for b=1 to 7
		for c=1 to 7
			for d=1 to 7
				for e=1 to 7
					if a=1 then a=c11
					if a=2 then a=c12
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c11
					if b=2 then b=c12
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c11
					if c=2 then c=c12
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c11
					if d=2 then d=c12
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c11
					if e=2 then e=c12
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=b-1 and b=c-1 and c=d-1 and d=e-1 then mstraight=1
				next e
			next d
		next c
	next b
next a
for a=1 to 5
	for b=1 to 5
		for c=1 to 5
			for d=1 to 5
				for e=1 to 5
					if a=1 then a=c21
					if a=2 then a=c22
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c21
					if b=2 then b=c22
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c21
					if c=2 then c=c22
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c21
					if d=2 then d=c22
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c21
					if e=2 then e=c22
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=b-1 and b=c-1 and c=d-1 and d=e-1 then ostraight=1
				next e
			next d
		next c
	next b
next a
if s11=s12 and s12=s31 and s31=s32 and s32=s33 then mflush=1
if s21=s22 and s22=s31 and s31=s32 and s32=s33 then oflush=1
for a=1 to 5
	for b=1 to 5
		for c=1 to 5
			for d=1 to 5
				for e=1 to 5
					if a=1 then a=c11
					if a=2 then a=c12
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c11
					if b=2 then b=c12
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c11
					if c=2 then c=c12
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c11
					if d=2 then d=c12
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c11
					if e=2 then e=c12
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=b-1 and b=c-1 and c=d-1 and d=e-1 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mstraightflush=1
				next e
			next d
		next c
	next b
next a
for a=1 to 5
	for b=1 to 5
		for c=1 to 5
			for d=1 to 5
				for e=1 to 5
					if a=1 then a=c21
					if a=2 then a=c22
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c21
					if b=2 then b=c22
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c21
					if c=2 then c=c22
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c21
					if d=2 then d=c22
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c21
					if e=2 then e=c22
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=b-1 and b=c-1 and c=d-1 and d=e-1 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then ostraightflush=1
				next e
			next d
		next c
	next b
next a
for a=1 to 5
	for b=1 to 5
		for c=1 to 5
			for d=1 to 5
				for e=1 to 5
					if a=1 then a=c11
					if a=2 then a=c12
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c11
					if b=2 then b=c12
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c11
					if c=2 then c=c12
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c11
					if d=2 then d=c12
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c11
					if e=2 then e=c12
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=1 and b=10 and c=11 and d=12 and e=13 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mRoyalflush=1
					if a=10 and b=11 and c=12 and d=13 and e=1 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mRoyalflush=1
					if a=11 and b=12 and c=13 and d=1 and e=10 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mRoyalflush=1
					if a=12 and b=13 and c=1 and d=10 and e=11 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mRoyalflush=1
					if a=13 and b=1 and c=10 and d=11 and e=12 and s11=s12 and s12=s31 and s31=s32 and s32=s33 then mRoyalflush=1
				next e
			next d
		next c
	next b
next a
for a=1 to 5
	for b=1 to 5
		for c=1 to 5
			for d=1 to 5
				for e=1 to 5
					if a=1 then a=c21
					if a=2 then a=c22
					if a=3 then a=c31
					if a=4 then a=c32
					if a=5 then a=c33
					if b=1 then b=c21
					if b=2 then b=c22
					if b=3 then b=c31
					if b=4 then b=c32
					if b=5 then b=c33
					if c=1 then c=c21
					if c=2 then c=c22
					if c=3 then c=c31
					if c=4 then c=c32
					if c=5 then c=c33
					if d=1 then d=c21
					if d=2 then d=c22
					if d=3 then d=c31
					if d=4 then d=c32
					if d=5 then d=c33
					if e=1 then e=c21
					if e=2 then e=c22
					if e=3 then e=c31
					if e=4 then e=c32
					if e=5 then e=c33
					if a=1 and b=10 and c=11 and d=12 and e=13 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then oRoyalflush=1
					if a=10 and b=11 and c=12 and d=13 and e=1 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then oRoyalflush=1
					if a=11 and b=12 and c=13 and d=1 and e=10 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then oRoyalflush=1
					if a=12 and b=13 and c=1 and d=10 and e=11 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then oRoyalflush=1
					if a=13 and b=1 and c=10 and d=11 and e=12 and s21=s22 and s22=s31 and s31=s32 and s32=s33 then oRoyalflush=1
				next e
			next d
		next c
	next b
next a
return
 
 
 
chance1:
if chance<45
	if pairs=0 or opairs=0 then chance=45
endif
if chance<42
	if pairs=1 and twopairs=0 or opairs=1 and otwopairs=0 then chance=42
endif
if chance<4
	if pairs=1 and threeofakind=0 or opairs=1 and othreeofakind=0 then chance=4
endif
if chance<1
	if threeofakind=1 and ofourofakind=0 or othreeofakind=1 and ofourofakind=0 then chance=1
endif
if chance<12
	if threeofakind=1 and ofullhouse=0 or othreeofakind=1 and ofullhouse=0 then chance=12
endif
if chance<9
	if otwopairs=1 and ofullhouse=0 then chance=9
endif
if chance<6
	if ostraight=2 then chance=6
endif
if chance<20
	if oflush=1 then chance=20
endif
if chance<1
	if oflush=1 and ostraight=0 then chance=1
endif
if chance<1
	if oflush=0 and ostraight=1 then chance=1
endif
if chance<1
	if oflush=1 and ostraight=1 and oroyalflush=0 then chance=1
endif
return
 
 
 
chance2:
if chance<40
	if pairs=0 or opairs=0 then chance=40
endif
if chance<35
	if pairs=1 and twopairs=0 or opairs=1 and otwopairs=0 then chance=35
endif
if chance<5
	if pairs=1 and threeofakind=0 or opairs=1 and othreeofakind=0 then chance=5
endif
if chance<1
	if threeofakind=1 and ofourofakind=0 or othreeofakind=1 and ofourofakind=0 then chance=1
endif
if chance<13
	if threeofakind=1 and ofullhouse=0 or othreeofakind=1 and ofullhouse=0 then chance=13
endif
if chance<14
	if otwopairs=1 and ofullhouse=0 then chance=14
endif
if chance<7
	if ostraight=2 then chance=7
endif
if chance<22
	if oflush=1 then chance=22
endif
if chance<1
	if oflush=1 and ostraight=0 then chance=1
endif
if chance<1
	if oflush=0 and ostraight=1 then chance=1
endif
if chance<1
	if oflush=1 and ostraight=1 and oroyalflush=0 then chance=1
endif
return
 
 
 
turn:
turn=turn+1
if turn=3 then turn=1
movement=1
return
 
 
 
win:
if mtwopairs=0 and otwopairs=0 and threeofakind=0 and mthreeofakind=0 and othreeofakind=0 and mfourofakind=0 and ofourofakind=0 and mfullhouse=0 and ofullhouse=0mstraight=0 and ostraight=0
	if opairs=0 and mpairs=0 and pairs=0 and mflush=0 and oflush=0 and mstraightflush=0 and ostraightflush=0 and mroyalflush=0 and oroyalflush=0 and mstraight=0 and ostraight=0
		if c11>c21 and c11>c22 and c11>c31 and c11>c32 and c11>33 or c12>c21 and c12>c22 and c12>c31 and c12>32 and c12>c33 then mwin=1
		if c21>c21 and c21>c22 and c21>c31 and c21>c32 and c21>33 or c22>c21 and c22>c22 and c22>c31 and c22>32 and c22>c33 then owin=1
		if c31>c11 and c31>c12 and c31>c21 and c31>c22 or c32>c11 and c32>c12 and c32>c21 and c32>c22 or c33>c11 and c33>c12 and c33>c21 and c33>c22 then tie=1
	endif
endif
if mtwopairs=0 and otwopairs=0 and threeofakind=0 and mthreeofakind=0 and othreeofakind=0 and mfourofakind=0 and ofourofakind=0 and mfullhouse=0 and ofullhouse=0
	if mflush=0 and oflush=0 and mstraightflush=0 and ostraightflush=0 and mroyalflush=0 and oroyalflush=0 and mstraight=0 and ostraight=0
		if opairs=1 and mpairs=0 and pairs=0 then owin=1
		if opairs=0 and mpairs=1 and pairs=0 then mwin=1
		if opairs=1 and mpairs=1 and pairs=0 or opairs=1 and mpairs=0 and pairs=1 or opairs=0 and mpairs=1 and pairs=1 then tie=1
	endif
endif
if threeofakind=0 and mthreeofakind=0 and othreeofakind=0 and mfourofakind=0 and ofourofakind=0 and mfullhouse=0 and ofullhouse=0 and mstraight=0 and ostraight=0
	if mflush=0 and oflush=0 and mstraightflush=0 and ostraightflush=0 and mroyalflush=0 and oroyalflush=0
		if otwopairs=1 and mtwopairs=0 then owin=1
		if otwopairs=0 and mtwopairs=1 then mwin=1
		if otwopairs=1 and mtwopairs=1 or mtwopairs=0 and otwopairs=0 then tie=1
	endif
endif
if mfourofakind=0 and ofourofakind=0 and mfullhouse=0 and ofullhouse=0 and mstraight=0 and ostraight=0
	if mflush=0 and oflush=0 and mstraightflush=0 and ostraightflush=0 and mroyalflush=0 and oroyalflush=0
		if othreeofakind=1 and mthreeofakind=0 and threeofakind=0 then owin=1
		if othreeofakind=0 and mthreeofakind=1 and threeofakind=0 then mwin=1
		if othreeofakind=1 and mthreeofakind=1 and threeofakind=0 or threeofakind=1 and mthreeofakind=0 and othreeofakind=1 or othreeofakind=0 and mthreeofakind=1 and threeofakind=1 then tie=1
	endif
endif
if mfourofakind=0 and ofourofakind=0 and mfullhouse=0 and ofullhouse=0
	if mflush=0 and oflush=0 and mstraightflush=0 and ostraightflush=0 and mroyalflush=0 and oroyalflush=0
		if ostraight=1 and mstraight=0 then owin=1
		if ostraight=0 and mstraightd=1 then mwin=1
		if ostraight=1 and mstraight=1 or mthreeofakind=0 and othreeofakind=1 or othreeofakind=0 and mthreeofakind=1 and threeofakind=1 then tie=1
	endif
endif
if mwin=1
	cash=cash+pot
	gosub gamestart
endif
if owin=1
	ocash=ocash+pot
	gosub gamestart
endif
if tie=1
	pot=pot/2
	cash=cash+pot
	ocash=ocash+pot
	gosub gamestart
endif
return