source: liacs/ai/poker/data/pre-parse.pl.tex@ 325

Last change on this file since 325 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 6.7 KB
Line 
1% Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
2\noindent
3\mbox{}\texttt{001:} \#!/usr/bin/env\ perl\ -w \\
4\mbox{}\texttt{002:} \\
5\mbox{}\texttt{003:} \textbf{while\ }(\$line\ =\ $<$STDIN$>$)\ \{ \\
6\mbox{}\texttt{004:} \ \ \ \ \#Input\ in\ way\ more\ every\ workable\ \textbf{format} \\
7\mbox{}\texttt{005:} \ \ \ \ @numbers\ =\ \textbf{split}(\texttt{','},\$line); \\
8\mbox{}\texttt{006:} \\
9\mbox{}\texttt{007:} \ \ \ \ \#Get\ the\ number\ of\ every\ colour\ in\ on\ every\ line \\
10\mbox{}\texttt{008:} \ \ \ \ @colour\ =\ (0,\ 0,\ 0,\ 0,\ 0); \\
11\mbox{}\texttt{009:} \ \ \ \ \textbf{foreach\ }(0,2,4,6,8)\ \{ \\
12\mbox{}\texttt{010:} \ \ \ \ \ \ \ \ \$colour[\$numbers[\$$\_$]]++; \\
13\mbox{}\texttt{011:} \ \ \ \ \} \\
14\mbox{}\texttt{012:} \\
15\mbox{}\texttt{013:} \ \ \ \ \#Find\ pairs,\ triples,\ four \\
16\mbox{}\texttt{014:} \ \ \ \ @cards\ =\ (0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0); \\
17\mbox{}\texttt{015:} \ \ \ \ \textbf{foreach\ }(1,3,5,7,9)\ \{ \\
18\mbox{}\texttt{016:} \ \ \ \ \ \ \ \ \$cards[\$numbers[\$$\_$]]++; \\
19\mbox{}\texttt{017:} \ \ \ \ \} \\
20\mbox{}\texttt{018:} \\
21\mbox{}\texttt{019:} \ \ \ \ \#\#\#\ BEGIN\ Specials\ \#\#\# \\
22\mbox{}\texttt{020:} \ \ \ \ \#triple\ =\ 1,\ four\ =\ 2 \\
23\mbox{}\texttt{021:} \ \ \ \ \$special\ =\ 0; \\
24\mbox{}\texttt{022:} \ \ \ \ \#one\ pair\ =\ 1,\ two\ pair\ =\ 2 \\
25\mbox{}\texttt{023:} \ \ \ \ \$pairs\ =\ 0; \\
26\mbox{}\texttt{024:} \ \ \ \ \#\#\#\ END\ Specials\ \#\#\# \\
27\mbox{}\texttt{025:} \\
28\mbox{}\texttt{026:} \ \ \ \ \#\#\#\ BEGIN\ decoded\ specials\ \#\#\# \\
29\mbox{}\texttt{027:} \ \ \ \ \$onepair\ =\ 0; \\
30\mbox{}\texttt{028:} \ \ \ \ \$twopair\ =\ 0; \\
31\mbox{}\texttt{029:} \ \ \ \ \$triple\ =\ 0; \\
32\mbox{}\texttt{030:} \ \ \ \ \$four\ =\ 0; \\
33\mbox{}\texttt{031:} \ \ \ \ \#\#\#\ END\ decoded\ specials\ \#\#\# \\
34\mbox{}\texttt{032:} \\
35\mbox{}\texttt{033:} \ \ \ \ \textbf{foreach\ }(1\ ..\ 13)\ \{ \\
36\mbox{}\texttt{034:} \ \ \ \ \ \ \ \ \textbf{if}\ (\$cards[\$$\_$]\ ==\ 2)\ \{ \\
37\mbox{}\texttt{035:} \ \ \ \ \ \ \ \ \ \ \ \ \$pairs++; \\
38\mbox{}\texttt{036:} \ \ \ \ \ \ \ \ \ \ \ \ \textbf{if}\ (\$pairs\ ==\ 1)\ \{ \\
39\mbox{}\texttt{037:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$onepair\ =\ 1; \\
40\mbox{}\texttt{038:} \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$pairs\ ==\ 2)\ \{ \\
41\mbox{}\texttt{039:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$twopair\ =\ 1; \\
42\mbox{}\texttt{040:} \ \ \ \ \ \ \ \ \ \ \ \ \} \\
43\mbox{}\texttt{041:} \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$cards[\$$\_$]\ $>$\ 2)\ \{ \\
44\mbox{}\texttt{042:} \ \ \ \ \ \ \ \ \ \ \ \ \$special\ =\ \$cards[\$$\_$]; \\
45\mbox{}\texttt{043:} \ \ \ \ \ \ \ \ \ \ \ \ \textbf{if}\ (\ \$special\ ==\ 3)\ \{ \\
46\mbox{}\texttt{044:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$triple\ =\ 1; \\
47\mbox{}\texttt{045:} \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$special\ ==\ 4)\ \{ \\
48\mbox{}\texttt{046:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$four\ =\ 1; \\
49\mbox{}\texttt{047:} \ \ \ \ \ \ \ \ \ \ \ \ \} \\
50\mbox{}\texttt{048:} \ \ \ \ \ \ \ \ \} \\
51\mbox{}\texttt{049:} \ \ \ \ \} \\
52\mbox{}\texttt{050:} \\
53\mbox{}\texttt{051:} \ \ \ \ \#Decode\ into\ split\ option\ array \\
54\mbox{}\texttt{052:} \ \ \ \ @output\ =\ (0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0); \\
55\mbox{}\texttt{053:} \ \ \ \ \$output[\$numbers[10]]++; \\
56\mbox{}\texttt{054:} \\
57\mbox{}\texttt{055:} \ \ \ \ \$pairs\ /=\ 10; \\
58\mbox{}\texttt{056:} \ \ \ \ \$special\ /=\ 10; \\
59\mbox{}\texttt{057:} \ \ \ \ \textbf{foreach\ }(0\ ..\ 10)\ \{ \\
60\mbox{}\texttt{058:} \ \ \ \ \ \ \ \ \$numbers[\$$\_$]\ /=\ 10; \\
61\mbox{}\texttt{059:} \ \ \ \ \} \\
62\mbox{}\texttt{060:} \ \ \ \ \textbf{foreach\ }(0\ ..\ 4)\ \{ \\
63\mbox{}\texttt{061:} \ \ \ \ \ \ \ \ \$colour[\$$\_$]\ /=\ 10; \\
64\mbox{}\texttt{062:} \ \ \ \ \} \\
65\mbox{}\texttt{063:} \\
66\mbox{}\texttt{064:} \ \ \ \ \#\ Input\ 10\ \ :\ all\ cards \\
67\mbox{}\texttt{065:} \ \ \ \ \#\ Output\ 1\ \ :\ decoded\ version\ of\ result \\
68\mbox{}\texttt{066:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..10]\textbackslash{}n"{}}; \\
69\mbox{}\texttt{067:} \\
70\mbox{}\texttt{068:} \ \ \ \ \#\ Input\ 10\ \ :\ all\ cards \\
71\mbox{}\texttt{069:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ one\ node \\
72\mbox{}\texttt{070:} \ \ \ \ print\ \texttt{"{}@numbers[0..9]\ @output[0..9]\textbackslash{}n"{}}; \\
73\mbox{}\texttt{071:} \\
74\mbox{}\texttt{072:} \ \ \ \ \#\ Input\ 14\ \ :\ all\ cards\ +\ colours \\
75\mbox{}\texttt{073:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ one\ node \\
76\mbox{}\texttt{074:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ @output[0..9]\textbackslash{}n"{}}; \\
77\mbox{}\texttt{075:} \\
78\mbox{}\texttt{076:} \ \ \ \ \#\ Input\ 16\ \ :\ all\ cards\ +\ specials \\
79\mbox{}\texttt{077:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
80\mbox{}\texttt{078:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$pairs\ \$special\ @output[0..9]\textbackslash{}n"{}}; \\
81\mbox{}\texttt{079:} \\
82\mbox{}\texttt{080:} \ \ \ \ \#\ Input\ 14\ \ :\ all\ cards\ +\ decoded\ specials \\
83\mbox{}\texttt{081:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
84\mbox{}\texttt{082:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
85\mbox{}\texttt{083:} \\
86\mbox{}\texttt{084:} \ \ \ \ \#\ Input\ 18\ \ :\ all\ cards\ +\ colour\ +\ decoded\ specials \\
87\mbox{}\texttt{085:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
88\mbox{}\texttt{086:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
89\mbox{}\texttt{087:} \\
90\mbox{}\texttt{088:} \ \ \ \ \#\ Input\ 10:\ all\ cards \\
91\mbox{}\texttt{089:} \ \ \ \ \#\ output\ 2:\ full\ house,\ four\ of\ a\ kind \\
92\mbox{}\texttt{090:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ \$output[6]\ \$output[7]\textbackslash{}n"{}}; \\
93\mbox{}\texttt{091:} \\
94\mbox{}\texttt{092:} \ \ \ \ \#\ Input\ 16\ :\ all\ cards\ +\ specials \\
95\mbox{}\texttt{093:} \ \ \ \ \#\ output\ 1\ :\ full\ house \\
96\mbox{}\texttt{094:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$pairs\ \$special\ \$output[7]\textbackslash{}n"{}}; \\
97\mbox{}\texttt{095:} \\
98\mbox{}\texttt{096:} \ \ \ \ \#\ Input\ 2\ \ :\ Calculated\ set \\
99\mbox{}\texttt{097:} \ \ \ \ \#\ output\ 1\ :\ full\ house \\
100\mbox{}\texttt{098:} \ \ \ \ \#print\ \texttt{"{}\$pair\ \$special\ \$output[6]\textbackslash{}n"{}}; \\
101\mbox{}\texttt{099:} \\
102\mbox{}\texttt{100:} \ \ \ \ \#\ Input\ \ 8\ \ :\ colour\ +\ decoded\ specials \\
103\mbox{}\texttt{101:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
104\mbox{}\texttt{102:} \ \ \ \ \#print\ \texttt{"{}@colour[1..4]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
105\mbox{}\texttt{103:} \} \\
106
Note: See TracBrowser for help on using the repository browser.