global pootimer, playerHandCount, points, scoreBox, gScoreSprites, win
on shuffle me
unshuffled = []
shuffled = []
repeat with rank in ["ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"]
repeat with suit in ["hearts", "diamonds", "clubs", "spades"]
unshuffled.add([#rank: rank, #suit: suit])
end repeat
end repeat
repeat while unshuffled.count > 0
temp = unshuffled[random(unshuffled.count)]
shuffled.add(temp)
unshuffled.deleteOne(temp)
end repeat
shuffled.deleteAt(1)
shuffled.deleteAt(1)
return shuffled
end
on makesymbol thing
return string(thing).symbol
end
on getIntersect spnum
case spnum of
10:
if sprite(35).intersects(spnum) and sprite(35).visible then
return 1
else
return 0
end if
11:
if sprite(35).intersects(spnum) and sprite(35).visible then
return 1
else
if sprite(36).intersects(spnum) and sprite(36).visible then
return 1
else
return 0
end if
end if
12:
if sprite(36).intersects(spnum) and sprite(36).visible then
return 1
else
if sprite(37).intersects(spnum) and sprite(37).visible then
return 1
else
return 0
end if
end if
13:
if sprite(37).intersects(spnum) and sprite(37).visible then
return 1
else
if sprite(38).intersects(spnum) and sprite(38).visible then
return 1
else
return 0
end if
end if
14:
if sprite(38).intersects(spnum) and sprite(38).visible then
return 1
else
return 0
end if
15:
if sprite(35).intersects(spnum) and sprite(35).visible then
return 1
else
if sprite(39).intersects(spnum) and sprite(39).visible then
return 1
else
return 0
end if
end if
16:
if sprite(35).intersects(spnum) and sprite(35).visible then
return 1
else
if sprite(36).intersects(spnum) and sprite(36).visible then
return 1
else
if sprite(39).intersects(spnum) and sprite(39).visible then
return 1
else
if sprite(40).intersects(spnum) and sprite(40).visible then
return 1
else
return 0
end if
end if
end if
end if
17:
if sprite(36).intersects(spnum) and sprite(36).visible then
return 1
else
if sprite(37).intersects(spnum) and sprite(37).visible then
return 1
else
if sprite(40).intersects(spnum) and sprite(40).visible then
return 1
else
if sprite(41).intersects(spnum) and sprite(41).visible then
return 1
else
return 0
end if
end if
end if
end if
18:
if sprite(37).intersects(spnum) and sprite(37).visible then
return 1
else
if sprite(38).intersects(spnum) and sprite(38).visible then
return 1
else
if sprite(41).intersects(spnum) and sprite(41).visible then
return 1
else
if sprite(42).intersects(spnum) and sprite(42).visible then
return 1
else
return 0
end if
end if
end if
end if
19:
if sprite(38).intersects(spnum) and sprite(38).visible then
return 1
else
if sprite(42).intersects(spnum) and sprite(42).visible then
return 1
else
return 0
end if
end if
20:
if sprite(39).intersects(spnum) and sprite(39).visible then
return 1
else
if sprite(43).intersects(spnum) and sprite(43).visible then
return 1
else
return 0
end if
end if
21:
if sprite(39).intersects(spnum) and sprite(39).visible then
return 1
else
if sprite(40).intersects(spnum) and sprite(40).visible then
return 1
else
if sprite(43).intersects(spnum) and sprite(43).visible then
return 1
else
if sprite(44).intersects(spnum) and sprite(44).visible then
return 1
else
return 0
end if
end if
end if
end if
22:
if sprite(40).intersects(spnum) and sprite(40).visible then
return 1
else
if sprite(41).intersects(spnum) and sprite(41).visible then
return 1
else
if sprite(44).intersects(spnum) and sprite(44).visible then
return 1
else
if sprite(45).intersects(spnum) and sprite(45).visible then
return 1
else
return 0
end if
end if
end if
end if
23:
if sprite(41).intersects(spnum) and sprite(41).visible then
return 1
else
if sprite(42).intersects(spnum) and sprite(42).visible then
return 1
else
if sprite(45).intersects(spnum) and sprite(45).visible then
return 1
else
if sprite(46).intersects(spnum) and sprite(46).visible then
return 1
else
return 0
end if
end if
end if
end if
24:
if sprite(42).intersects(spnum) and sprite(42).visible then
return 1
else
if sprite(46).intersects(spnum) and sprite(46).visible then
return 1
else
return 0
end if
end if
25:
if sprite(43).intersects(spnum) and sprite(43).visible then
return 1
else
if sprite(47).intersects(spnum) and sprite(47).visible then
return 1
else
return 0
end if
end if
26:
if sprite(43).intersects(spnum) and sprite(43).visible then
return 1
else
if sprite(44).intersects(spnum) and sprite(44).visible then
return 1
else
if sprite(47).intersects(spnum) and sprite(47).visible then
return 1
else
if sprite(48).intersects(spnum) and sprite(48).visible then
return 1
else
return 0
end if
end if
end if
end if
27:
if sprite(44).intersects(spnum) and sprite(44).visible then
return 1
else
if sprite(45).intersects(spnum) and sprite(45).visible then
return 1
else
if sprite(48).intersects(spnum) and sprite(48).visible then
return 1
else
if sprite(49).intersects(spnum) and sprite(49).visible then
return 1
else
return 0
end if
end if
end if
end if
28:
if sprite(45).intersects(spnum) and sprite(45).visible then
return 1
else
if sprite(46).intersects(spnum) and sprite(46).visible then
return 1
else
if sprite(49).intersects(spnum) and sprite(49).visible then
return 1
else
if sprite(50).intersects(spnum) and sprite(50).visible then
return 1
else
return 0
end if
end if
end if
end if
29:
if sprite(46).intersects(spnum) and sprite(46).visible then
return 1
else
if sprite(50).intersects(spnum) and sprite(50).visible then
return 1
else
return 0
end if
end if
30:
if sprite(47).intersects(spnum) and sprite(47).visible then
return 1
else
return 0
end if
31:
if sprite(47).intersects(spnum) and sprite(47).visible then
return 1
else
if sprite(48).intersects(spnum) and sprite(48).visible then
return 1
else
return 0
end if
end if
32:
if sprite(48).intersects(spnum) and sprite(48).visible then
return 1
else
if sprite(49).intersects(spnum) and sprite(49).visible then
return 1
else
return 0
end if
end if
33:
if sprite(49).intersects(spnum) and sprite(49).visible then
return 1
else
if sprite(50).intersects(spnum) and sprite(50).visible then
return 1
else
return 0
end if
end if
34:
if sprite(50).intersects(spnum) and sprite(50).visible then
return 1
else
return 0
end if
35:
if sprite(51).intersects(spnum) and sprite(51).visible then
return 1
else
return 0
end if
36:
if sprite(51).intersects(spnum) and sprite(51).visible then
return 1
else
if sprite(52).intersects(spnum) and sprite(52).visible then
return 1
else
return 0
end if
end if
37:
if sprite(52).intersects(spnum) and sprite(52).visible then
return 1
else
if sprite(53).intersects(spnum) and sprite(53).visible then
return 1
else
return 0
end if
end if
38:
if sprite(53).intersects(spnum) and sprite(53).visible then
return 1
else
return 0
end if
39:
if sprite(51).intersects(spnum) and sprite(51).visible then
return 1
else
if sprite(54).intersects(spnum) and sprite(54).visible then
return 1
else
return 0
end if
end if
40:
if sprite(51).intersects(spnum) and sprite(51).visible then
return 1
else
if sprite(52).intersects(spnum) and sprite(52).visible then
return 1
else
if sprite(54).intersects(spnum) and sprite(54).visible then
return 1
else
if sprite(55).intersects(spnum) and sprite(55).visible then
return 1
else
return 0
end if
end if
end if
end if
41:
if sprite(52).intersects(spnum) and sprite(52).visible then
return 1
else
if sprite(53).intersects(spnum) and sprite(53).visible then
return 1
else
if sprite(55).intersects(spnum) and sprite(55).visible then
return 1
else
if sprite(56).intersects(spnum) and sprite(56).visible then
return 1
else
return 0
end if
end if
end if
end if
42:
if sprite(53).intersects(spnum) and sprite(53).visible then
return 1
else
if sprite(56).intersects(spnum) and sprite(56).visible then
return 1
else
return 0
end if
end if
43:
if sprite(54).intersects(spnum) and sprite(54).visible then
return 1
else
if sprite(57).intersects(spnum) and sprite(57).visible then
return 1
else
return 0
end if
end if
44:
if sprite(54).intersects(spnum) and sprite(54).visible then
return 1
else
if sprite(55).intersects(spnum) and sprite(55).visible then
return 1
else
if sprite(57).intersects(spnum) and sprite(57).visible then
return 1
else
if sprite(58).intersects(spnum) and sprite(58).visible then
return 1
else
return 0
end if
end if
end if
end if
45:
if sprite(55).intersects(spnum) and sprite(55).visible then
return 1
else
if sprite(56).intersects(spnum) and sprite(56).visible then
return 1
else
if sprite(58).intersects(spnum) and sprite(58).visible then
return 1
else
if sprite(59).intersects(spnum) and sprite(59).visible then
return 1
else
return 0
end if
end if
end if
end if
46:
if sprite(56).intersects(spnum) and sprite(56).visible then
return 1
else
if sprite(59).intersects(spnum) and sprite(59).visible then
return 1
else
return 0
end if
end if
47:
if sprite(57).intersects(spnum) and sprite(57).visible then
return 1
else
return 0
end if
48:
if sprite(57).intersects(spnum) and sprite(57).visible then
return 1
else
if sprite(58).intersects(spnum) and sprite(58).visible then
return 1
else
return 0
end if
end if
49:
if sprite(58).intersects(spnum) and sprite(58).visible then
return 1
else
if sprite(59).intersects(spnum) and sprite(59).visible then
return 1
else
return 0
end if
end if
50:
if sprite(59).intersects(spnum) and sprite(59).visible then
return 1
else
return 0
end if
otherwise:
return 0
end case
end
on gotoit
pootimer.forget()
go("gameover")
end
on getCode arg1, arg2
ag = string(arg1) & "-" & string(arg2)
return ag
end
on getValue arg
if (arg contains "hearts") or (arg contains "spades") then
return getOff(chars(arg, 1, arg.length - 7))
else
if arg contains "diamonds" then
return getOff(chars(arg, 1, arg.length - 9))
else
if arg contains "clubs" then
return getOff(chars(arg, 1, arg.length - 6))
end if
end if
end if
end
on roundOff arg
put arg
if (arg >= 10) or (arg <= 14) then
return 10
else
if (arg >= 20) or (arg <= 24) then
return 20
else
if (arg >= 30) or (arg <= 34) then
return 30
else
if (arg >= 40) or (arg <= 44) then
return 40
else
if (arg >= 50) or (arg <= 54) then
return 50
else
if (arg >= 60) or (arg <= 64) then
return 60
else
if (arg >= 70) or (arg <= 74) then
return 70
else
if (arg >= 80) or (arg <= 84) then
return 80
else
if (arg >= 90) or (arg <= 94) then
return 90
else
if (arg >= 100) or (arg <= 104) then
return 100
else
if (arg >= 110) or (arg <= 114) then
return 110
else
if (arg >= 120) or (arg <= 124) then
return 120
else
if (arg >= 130) or (arg <= 134) then
return 130
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end
on getOff numba
if numba = "ace" then
return 10
else
if numba = "two" then
return 20
else
if numba = "three" then
return 30
else
if numba = "four" then
return 40
else
if numba = "five" then
return 50
else
if numba = "six" then
return 60
else
if numba = "seven" then
return 70
else
if numba = "eight" then
return 80
else
if numba = "nine" then
return 90
else
if numba = "ten" then
return 100
else
if numba = "jack" then
return 110
else
if numba = "queen" then
return 120
else
if numba = "king" then
return 130
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end
on getSuit arg
if arg contains "hearts" then
return 1
else
if arg contains "diamonds" then
return 2
else
if arg contains "clubs" then
return 3
else
if arg contains "spades" then
return 4
end if
end if
end if
end if
end
on getHand handy
if ilk(handy, #list) then
myHand = VOID
if handy[1][1] = 10 then
myHand = #ace
end if
if (handy[1][1] = handy[2][1]) or (handy[2][1] = handy[3][1]) or (handy[3][1] = handy[4][1]) or (handy[4][1] = handy[5][1]) then
myHand = #pair
end if
if ((handy[1][1] = handy[2][1]) and (handy[3][1] = handy[4][1])) or ((handy[1][1] = handy[2][1]) and (handy[4][1] = handy[5][1])) or ((handy[2][1] = handy[3][1]) and (handy[4][1] = handy[5][1])) then
myHand = #twopair
end if
if ((handy[1][1] = handy[2][1]) and (handy[2][1] = handy[3][1])) or ((handy[2][1] = handy[3][1]) and (handy[3][1] = handy[4][1])) or ((handy[3][1] = handy[4][1]) and (handy[4][1] = handy[5][1])) then
myHand = #threeofakind
end if
if (handy[1][1] = (handy[2][1] - 10)) and (handy[2][1] = (handy[3][1] - 10)) and (handy[3][1] = (handy[4][1] - 10)) and (handy[4][1] = (handy[5][1] - 10)) then
myHand = #straight
end if
if (handy[1][2] = handy[2][2]) and (handy[2][2] = handy[3][2]) and (handy[3][2] = handy[4][2]) and (handy[4][2] = handy[5][2]) then
myHand = #flush
end if
if ((handy[1][1] = handy[2][1]) and ((handy[3][1] = handy[4][1]) and (handy[4][1] = handy[5][1]))) or ((handy[4][1] = handy[5][1]) and ((handy[1][1] = handy[2][1]) and (handy[2][1] = handy[3][1]))) then
myHand = #fullhouse
end if
if ((handy[1][1] = handy[2][1]) and (handy[2][1] = handy[3][1]) and (handy[3][1] = handy[4][1])) or ((handy[2][1] = handy[3][1]) and (handy[3][1] = handy[4][1]) and (handy[4][1] = handy[5][1])) then
myHand = #fourofakind
end if
if (handy[1][1] = (handy[2][1] - 10)) and (handy[2][1] = (handy[3][1] - 10)) and (handy[3][1] = (handy[4][1] - 10)) and (handy[4][1] = (handy[5][1] - 10)) and ((handy[1][2] = handy[2][2]) and (handy[2][2] = handy[3][2]) and (handy[3][2] = handy[4][2]) and (handy[4][2] = handy[5][2])) then
myHand = #straightflush
end if
if (handy[1][1] = 10) and (handy[2][1] = 100) and (handy[3][1] = 110) and (handy[4][1] = 120) and (handy[5][1] = 130) and ((handy[1][2] = handy[2][2]) and (handy[2][2] = handy[3][2]) and (handy[3][2] = handy[4][2]) and (handy[4][2] = handy[5][2])) then