2
local [ranks suits rankarray]
4
if fourp [print [four of a kind] stop]
5
if full.housep [print [full house] stop]
6
if threep [print [three of a kind] stop]
7
if pairp [print ifelse paircount = 1 [[one pair]] [[two pairs]] stop]
8
if ace.highp [print ifelse flushp [[royal flush]] [[straight]] stop]
9
if straightp [print ifelse flushp [[straight flush]] [[straight]] stop]
10
if flushp [print [flush] stop]
15
make "ranks map [ranknum butlast ?] :cards
16
make "suits remdup map "last :cards
17
make "rankarray {0 0 0 0 0 0 0 0 0 0 0 0 0}
18
foreach :ranks [setitem ? :rankarray (item ? :rankarray)+1]
22
if :rank = "a [output 1]
23
if :rank = "j [output 11]
24
if :rank = "q [output 12]
25
if :rank = "k [output 13]
30
output memberp 4 :rankarray
34
output memberp 3 :rankarray
38
output memberp 2 :rankarray
42
output and threep pairp
46
output count locate 2 1
49
to locate :number :index
50
if :index > 13 [output []]
51
if (item :index :rankarray) = :number ~
52
[output fput :index (locate :number :index+1)]
53
output locate :number :index+1
57
output emptyp butfirst :suits
61
output nogap (reduce "min :ranks) 5
65
output ifelse :a < :b [:a] [:b]
68
to nogap :smallest :howmany
69
if :howmany=0 [output "true]
70
if not equalp (item :smallest :rankarray) 1 [output "false]
71
output nogap :smallest+1 :howmany-1
75
if not equalp (item 1 :rankarray) 1 [output "false]