-
Notifications
You must be signed in to change notification settings - Fork 0
/
TripleGameApi.html
199 lines (196 loc) · 63.8 KB
/
TripleGameApi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!doctype html>
<html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title> - Documentation</title><link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500|Roboto:300,500,700" rel="stylesheet"/><style>body{margin: 0;
padding: 0;
color: #000;
font-family: Roboto, sans-serif;
font-weight: 300;
line-height: 26px;
font-size: 17px;}*{-moz-box-sizing: border-box;
box-sizing: border-box;}</style></head><body><main id="app"><div data-radium="true"><div style="position:fixed;box-shadow:0px 2px 3px 0px rgba(0, 0, 0, 0.25);width:100%;min-width:100%;margin-left:0px;margin-right:0px;height:65px;z-index:99;background:#FFFFFF;padding-top:10px;padding-bottom:10px;padding-left:20px;padding-right:20px;" data-radium="true"><div style="margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px;" class="rmq-87b609c0 rmq-159a7c96 rmq-27601239" data-radium="true"><div style="margin-left:-15px;margin-right:-15px;" data-radium="true"><div style="position:relative;min-height:1px;padding-left:15px;padding-right:15px;float:left;width:50.00000%;" class="rmq-aa1729d5 rmq-a22eaf97 rmq-1918856d rmq-6156e77b rmq-21ab0466 rmq-a01b93a4 rmq-d226cb7e rmq-5cc71c8" data-radium="true"><svg fill="currentColor" preserveAspectRatio="xMidYMid meet" height="1em" width="1em" viewBox="0 0 40 40" style="vertical-align:inherit;font-size:36px;margin-right:20px;"><g><path d="m30 22.5h-5c-1.3 0-2.5 1.3-2.5 2.5h10c0-1.3-1.2-2.5-2.5-2.5z m-2.1-16.2c-6.6 0-8.2 1.2-9.1 2.1-1-0.9-2.6-2.1-9.2-2.1s-9.6 1.7-9.6 3v22.9c1.1-0.6 4.6-1.9 8.4-2.2 4.4-0.4 9.1 0.4 9.1 1.2 0 0.7 0.3 1.3 1.2 1.3h0.1c0.9 0 1.2-0.6 1.2-1.2 0-0.9 4.6-1.7 9.1-1.3 3.7 0.3 7.3 1.6 8.4 2.2v-22.9c0-1.3-3.1-3-9.6-3z m-10.4 22.3c-1.2-0.6-4-1.1-7.5-1.1s-6.6 0.5-7.5 1.1v-17.3s2.5-2.4 7.5-2.4 7.5 1.1 7.5 2.4v17.3z m17.5 0c-0.9-0.6-4-1.1-7.5-1.1s-6.3 0.5-7.5 1.1v-17.3s2.5-2.4 7.5-2.4 7.5 1.1 7.5 2.4v17.3z m-5-11.1h-5c-1.3 0-2.5 1.3-2.5 2.5h10c0-1.3-1.2-2.5-2.5-2.5z m0-5h-5c-1.3 0-2.5 1.3-2.5 2.5h10c0-1.3-1.2-2.5-2.5-2.5z m-17.5 5h-5c-1.2 0-2.5 1.2-2.5 2.5h10c0-1.2-1.2-2.5-2.5-2.5z m0 5h-5c-1.2 0-2.5 1.2-2.5 2.5h10c0-1.2-1.2-2.5-2.5-2.5z m0-10h-5c-1.2 0-2.5 1.2-2.5 2.5h10c0-1.2-1.2-2.5-2.5-2.5z"></path></g></svg><div style="display:inline-block;" data-radium="true"><div style="text-transform:uppercase;font-family:Roboto, sans-serif;" data-radium="true"></div><div style="font-family:Roboto Mono, Menlo, Monaco, Courier, monospace;font-weight:300;" data-radium="true"></div></div></div><div style="position:relative;min-height:1px;padding-left:15px;padding-right:15px;float:right !important;width:25.00000%;text-align:right;font-size:36px;" class="rmq-aa1729d5 rmq-a22eaf97 rmq-1918856d rmq-6156e77b rmq-77267d84 rmq-5c0c1446 rmq-4605701c rmq-34ee8e6a" data-radium="true"><a href="https://github.com/WilliCommer/triple-game#readme"><svg fill="currentColor" preserveAspectRatio="xMidYMid meet" height="1em" width="1em" viewBox="0 0 40 40" style="vertical-align:middle;"><g><path d="m20 0c-11 0-20 9-20 20 0 8.8 5.7 16.3 13.7 19 1 0.2 1.3-0.5 1.3-1 0-0.5 0-2 0-3.7-5.5 1.2-6.7-2.4-6.7-2.4-0.9-2.3-2.2-2.9-2.2-2.9-1.9-1.2 0.1-1.2 0.1-1.2 2 0.1 3.1 2.1 3.1 2.1 1.7 3 4.6 2.1 5.8 1.6 0.2-1.3 0.7-2.2 1.3-2.7-4.5-0.5-9.2-2.2-9.2-9.8 0-2.2 0.8-4 2.1-5.4-0.2-0.5-0.9-2.6 0.2-5.3 0 0 1.7-0.5 5.5 2 1.6-0.4 3.3-0.6 5-0.6 1.7 0 3.4 0.2 5 0.7 3.8-2.6 5.5-2.1 5.5-2.1 1.1 2.8 0.4 4.8 0.2 5.3 1.3 1.4 2.1 3.2 2.1 5.4 0 7.6-4.7 9.3-9.2 9.8 0.7 0.6 1.4 1.9 1.4 3.7 0 2.7 0 4.9 0 5.5 0 0.6 0.3 1.2 1.3 1 8-2.7 13.7-10.2 13.7-19 0-11-9-20-20-20z"></path></g></svg></a></div><div style="clear:both;" data-radium="true"></div></div><div style="clear:both;" data-radium="true"></div></div></div><div style="margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px;padding-top:104px;" class="rmq-87b609c0 rmq-159a7c96 rmq-27601239" data-radium="true"><div style="margin-left:-15px;margin-right:-15px;" data-radium="true"><div style="position:fixed;min-height:1px;padding-left:15px;padding-right:15px;float:left;width:8.33333%;height:80%;max-width:300px;" class="rmq-aa1729d5 rmq-a22eaf97 rmq-1918856d rmq-6156e77b rmq-5c4c5b38 rmq-5c0c1446 rmq-4605701c rmq-34ee8e6a rmq-35757987 rmq-f09e82ae" data-radium="true"><div style="font-family:Roboto, sans-serif;border-radius:4px;padding-top:0;padding-bottom:0;margin-top:26px;border:1px solid #e6e9ed;font-weight:500;font-size:15px;line-height:18px;max-height:70vh;overflow-x:auto;" data-radium="true"><ul style="list-style:none;margin-top:0;margin-bottom:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#require" data-radium="true">require</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#triplegame" data-radium="true">TripleGame</a></li><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><div style="padding-top:0;" data-radium="true"><span style="text-transform:uppercase;font-size:13px;line-height:18px;color:#666;" data-radium="true">Static</span><ul style="list-style:none;padding-left:0;" data-radium="true"><li data-radium="true"><a href="#triplegamenewgame" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">newGame</a></li><li data-radium="true"><a href="#triplegameusermove" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">userMove</a></li><li data-radium="true"><a href="#triplegameturn" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">turn</a></li><li data-radium="true"><a href="#triplegameundomove" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">undoMove</a></li><li data-radium="true"><a href="#triplegameswapreserve" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">swapReserve</a></li><li data-radium="true"><a href="#triplegameislegalmove" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">isLegalMove</a></li><li data-radium="true"><a href="#triplegamegameover" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">gameOver</a></li><li data-radium="true"><a href="#triplegameaddfigure" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">addFigure</a></li><li data-radium="true"><a href="#triplegamesetconfig" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">setConfig</a></li><li data-radium="true"><a href="#triplegamegetconfig" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getConfig</a></li><li data-radium="true"><a href="#triplegamesetstate" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">setState</a></li><li data-radium="true"><a href="#triplegamegetstate" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getState</a></li><li data-radium="true"><a href="#triplegameon" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">on</a></li><li data-radium="true"><a href="#triplegametostring" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">toString</a></li><li data-radium="true"><a href="#triplegameenablelogger" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">enableLogger</a></li></ul></div></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#gamestate" data-radium="true">GameState</a></li><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><div style="padding-top:0;" data-radium="true"><span style="text-transform:uppercase;font-size:13px;line-height:18px;color:#666;" data-radium="true">Static</span><ul style="list-style:none;padding-left:0;" data-radium="true"><li data-radium="true"><a href="#gamestatenext" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">next</a></li><li data-radium="true"><a href="#gamestatereserve" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">reserve</a></li><li data-radium="true"><a href="#gamestatescore" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">score</a></li><li data-radium="true"><a href="#gamestategold" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">gold</a></li><li data-radium="true"><a href="#gamestateundo_enable" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">undo_enable</a></li><li data-radium="true"><a href="#gamestategame_over" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">game_over</a></li><li data-radium="true"><a href="#gamestatemove_count" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">move_count</a></li></ul></div></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#pos" data-radium="true">Pos</a></li><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><div style="padding-top:0;" data-radium="true"><span style="text-transform:uppercase;font-size:13px;line-height:18px;color:#666;" data-radium="true">Instance</span><ul style="list-style:none;padding-left:0;" data-radium="true"><li data-radium="true"><a href="#posassign" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">assign</a></li><li data-radium="true"><a href="#poskey" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">key</a></li><li data-radium="true"><a href="#poskey" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">key</a></li><li data-radium="true"><a href="#poseq" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">eq</a></li></ul></div></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#board" data-radium="true">Board</a></li><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><div style="padding-top:0;" data-radium="true"><span style="text-transform:uppercase;font-size:13px;line-height:18px;color:#666;" data-radium="true">Instance</span><ul style="list-style:none;padding-left:0;" data-radium="true"><li data-radium="true"><a href="#boardget" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">get</a></li><li data-radium="true"><a href="#boardset" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">set</a></li><li data-radium="true"><a href="#boardgetpos" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getPos</a></li><li data-radium="true"><a href="#boardsetpos" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">setPos</a></li><li data-radium="true"><a href="#boardforeach" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">forEach</a></li><li data-radium="true"><a href="#boardgethash" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getHash</a></li><li data-radium="true"><a href="#boardgetposlist" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getPosList</a></li><li data-radium="true"><a href="#boardfill" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">fill</a></li><li data-radium="true"><a href="#boardvalidpos" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">validPos</a></li><li data-radium="true"><a href="#boardmove" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">move</a></li><li data-radium="true"><a href="#boardneighbours" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">neighbours</a></li><li data-radium="true"><a href="#boardgetcluster" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">getCluster</a></li><li data-radium="true"><a href="#boardtostring" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">toString</a></li><li data-radium="true"><a href="#boardtostringframed" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">toStringFramed</a></li><li data-radium="true"><a href="#boardsetstring" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">setString</a></li></ul></div></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#triple_fig" data-radium="true">TRIPLE_FIG</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figure" data-radium="true">Figure</a></li><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><div style="padding-top:0;" data-radium="true"><span style="text-transform:uppercase;font-size:13px;line-height:18px;color:#666;" data-radium="true">Static</span><ul style="list-style:none;padding-left:0;" data-radium="true"><li data-radium="true"><a href="#figureid" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">id</a></li><li data-radium="true"><a href="#figurekey" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">key</a></li><li data-radium="true"><a href="#figurename" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">name</a></li><li data-radium="true"><a href="#figurescore" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">score</a></li><li data-radium="true"><a href="#figuregold" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">gold</a></li><li data-radium="true"><a href="#figuregrowto" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">growto</a></li><li data-radium="true"><a href="#figuredestroyto" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">destroyto</a></li><li data-radium="true"><a href="#figureimg" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">img</a></li><li data-radium="true"><a href="#figurecost" style="font-family:Roboto, sans-serif;font-weight:300;font-size:13px;line-height:16px;text-decoration:none;color:#555;" data-radium="true">cost</a></li></ul></div></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figurelist" data-radium="true">figureList</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figures" data-radium="true">figures</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figureprop" data-radium="true">figureProp</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figurebyid" data-radium="true">figureById</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:1px solid #e6e9ed;" data-radium="true"><a style="color:#000;" href="#figureimgurl" data-radium="true">figureImgUrl</a></li></div><div data-radium="true"><li style="padding-left:20px;padding-right:20px;padding-top:13px;padding-bottom:13px;border-bottom:none;" data-radium="true"><a style="color:#000;" href="#configlist" data-radium="true">configList</a></li></div></ul></div></div><div style="position:relative;min-height:1px;padding-left:15px;padding-right:15px;float:left;width:100.00000%;" class="rmq-aa1729d5 rmq-a22eaf97 rmq-1918856d rmq-6156e77b rmq-89bb2272 rmq-2d0e68c6 rmq-3752549c rmq-3b9282ea rmq-4d29a8df rmq-ea7683a5 rmq-ad95cc33" data-radium="true"><div class="content" data-radium="true"><style>h1, h2, h3, h4, h5, h6{font-family: Roboto, sans-serif;
font-weight: 300;}h1{font-size: 48px;
line-height: 72px;}h2{font-size: 24px;
line-height: 36px;}h3{font-size: 19px;
line-height: 29px;
font-weight: 400;}h4{font-size: 17px;
line-height: 22px;
font-weight: 400;}a{text-decoration: none;
color: #00AAFF;
:hover: [object Object];}a.anchor:before{content: "";
display: block;
height: 100px;
margin: -80px 0 0;}.content blockquote{padding-left: 20px;
margin: 0;
border-left: 4px solid #eee;}.content ul, content li{list-style: none;}.content ul li:before{color: #CCC;
float: left;
margin-left: -20px;
margin-top: 1px;
content: "•";}pre.hljs, pre > code{margin-bottom: 30px;
font-family: Roboto Mono, Menlo, Monaco, Courier, monospace;
padding: 12px 15px 12px 15px;
border-radius: 4px;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
display: block;
position: relative;
overflow-x: auto;
font-size: 13px;
color: #666;
white-space: pre;}code{font-family: Roboto Mono, Menlo, Monaco, Courier, monospace;
display: inline;
font-size: 13px;
font-weight: 400;
margin: 0 2px;
padding: 1px 6px;
box-shadow: 0 0 0 1px #DDD;
white-space: nowrap;
border-radius: 4px;}.hljs{display: block;
overflow-x: auto;}.hljs-comment, .hljs-quote{color: #998;
font-style: italic;}.hljs-keyword, .hljs-selector-tag, .hljs-subst{color: #333;
font-weight: bold;}.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable, .hljs-tag .hljs-attr{color: #008080;}.hljs-string, .hljs-doctag{color: #d14;}.hljs-title, .hljs-section, .hljs-selector-id{color: #900;
font-weight: bold;}.hljs-subst{font-weight: normal;}.hljs-type, .hljs-class .hljs-title{color: #458;
font-weight: bold;}.hljs-tag, .hljs-name, .hljs-attribute{color: #000080;
font-weight: normal;}.hljs-regexp, .hljs-link{color: #009926;}.hljs-symbol, .hljs-bullet{color: #990073;}.hljs-built_in, .hljs-builtin-name{color: #0086b3;}.hljs-meta{color: #999;
font-weight: bold;}.hljs-deletion{background: #fdd;}.hljs-addition{background: #dfd;}.hljs-emphasis{font-style: italic;}.hljs-strong{font-weight: bold;}</style><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="require"></a>require</h1><div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="triplegame"></a>TripleGame</h1><div><p>Triple Game Engine</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>aConfig: Config (=defaultConfig)</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>any</code><span> this
</span></div></div><div data-radium="true"><div data-radium="true"><h4>Example</h4><pre><code><span class="hljs-keyword">const</span> {Game, TRIPLE_FIG} = <span class="hljs-built_in">require</span>(<span class="hljs-string">'triple-game)'</span>;
<span class="hljs-keyword">var</span> game = <span class="hljs-keyword">new</span> Game();
game.userMove(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>);</code></pre></div></div><div data-radium="true"><h2 style="text-transform:uppercase;" data-radium="true">static</h2><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamenewgame"></a>TripleGame.newGame</h3><pre><code>newGame</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>newGame() start new game</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameusermove"></a>TripleGame.userMove</h3><pre><code>userMove</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Let the player (user) place next figure to field (x,y)</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>x: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>y: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>fig: integer</code>: <div style="display:inline-block;" data-radium="true">a optional figure to play
</div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameturn"></a>TripleGame.turn</h3><pre><code>turn(pos: <a href="#pos">Pos</a>)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Let the player (user) place next figure to field (pos)</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameundomove"></a>TripleGame.undoMove</h3><pre><code>undoMove</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>undoMove() undo last user move</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameswapreserve"></a>TripleGame.swapReserve</h3><pre><code>swapReserve</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>swapReserve() swap reserve and next figure</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameislegalmove"></a>TripleGame.isLegalMove</h3><pre><code>isLegalMove</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Check if figure can be set on pos</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true">board coordinates
</div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>fig: integer</code>: <div style="display:inline-block;" data-radium="true">figure to set on this field
</div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>any</code><span> boolean
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamegameover"></a>TripleGame.gameOver</h3><pre><code>gameOver(): any</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>any</code><span> boolean true if no more moves possible
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameaddfigure"></a>TripleGame.addFigure</h3><pre><code>addFigure</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>add nextFigure from shop</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>fig: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamesetconfig"></a>TripleGame.setConfig</h3><pre><code>setConfig</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>set game configuration. board size, figure probability etc.</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>newConfig: Config</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamegetconfig"></a>TripleGame.getConfig</h3><pre><code>getConfig</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>get game configuration</p>
</div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>Config</code><span>
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamesetstate"></a>TripleGame.setState</h3><pre><code>setState</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>set game for example from a backup</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>newState: <a href="#gamestate">GameState</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegamegetstate"></a>TripleGame.getState</h3><pre><code>getState</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>get game state. actual bard as string, next_figure, score etc.</p>
</div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="#gamestate">GameState</a></code><span>
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameon"></a>TripleGame.on</h3><pre><code>on</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Set event callback. For detaile @see <a href="game-events.html">"Game Events"</a>.</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>eventName: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>callback: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><div data-radium="true"><h4>Example</h4><pre><code><span class="hljs-comment">// log game over</span>
game.on(<span class="hljs-string">'gameover'</span>, (e) => {<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'GAME OVER'</span>)} );
<span class="hljs-comment">// use 'all' for all events</span>
game.on(<span class="hljs-string">'all'</span>, (e) => {<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'event:'</span>, e.name )} );</code></pre></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegametostring"></a>TripleGame.toString</h3><pre><code>toString</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Return game as string</p>
</div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><span>
</span></div></div><div data-radium="true"><div data-radium="true"><h4>Example</h4><pre><code><span class="hljs-built_in">console</span>.log( <span class="hljs-keyword">new</span> <span class="hljs-built_in">require</span>(<span class="hljs-string">'triple-game'</span>).Game().toString() );
<span class="hljs-number">0</span> <span class="hljs-number">1</span> <span class="hljs-number">2</span> <span class="hljs-number">3</span>
-----------
<span class="hljs-number">0</span>| <span class="hljs-number">1</span> <span class="hljs-number">1</span>
<span class="hljs-number">1</span>| <span class="hljs-number">4</span> <span class="hljs-number">1</span> <span class="hljs-number">1</span>
<span class="hljs-number">2</span>| <span class="hljs-number">1</span>
<span class="hljs-number">3</span>|
next: <span class="hljs-number">2</span> reserve: <span class="hljs-number">0</span> score: <span class="hljs-number">0</span> gold: <span class="hljs-number">0</span></code></pre></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="triplegameenablelogger"></a>TripleGame.enableLogger</h3><pre><code>enableLogger</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Logger show game events on console. Parameter is true | false | array of event names.</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>val: (<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a> | <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a><<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>>)</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div style="display:inline;" data-radium="true"><h4>See</h4><ul data-radium="true"><li><div><p><a href="game-events.html">"Game Events"</a>.</p>
</div></li></ul></div></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="gamestate"></a>GameState</h1><div><p>GameState</p>
</div><div data-radium="true"><h2 style="text-transform:uppercase;" data-radium="true">static</h2><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestatenext"></a>GameState.next</h3><pre><code>next</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>next figure</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestatereserve"></a>GameState.reserve</h3><pre><code>reserve: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>reserve figure</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestatescore"></a>GameState.score</h3><pre><code>score: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>actual score</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestategold"></a>GameState.gold</h3><pre><code>gold: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>gold</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestateundo_enable"></a>GameState.undo_enable</h3><pre><code>undo_enable: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestategame_over"></a>GameState.game_over</h3><pre><code>game_over: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="gamestatemove_count"></a>GameState.move_count</h3><pre><code>move_count: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>number of moves in this game</p>
</div></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="pos"></a>Pos</h1><div><p>Stores X,Y coordinates</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>args: ...args</code>: <div style="display:inline-block;" data-radium="true">see
<a href="#assign">#assign</a>
for optional parameter
</div></li></div></ol></div><div data-radium="true"><h2 style="text-transform:uppercase;" data-radium="true">instance</h2><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="posassign"></a>Pos.prototype.assign</h3><pre><code>assign(args: type)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>assign(1,2) or assign('1-2') or assign(new Pos(1,2))</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>args: type</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="poskey"></a>Pos.prototype.key</h3><pre><code>key</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code><span> a key like '5-6'
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="poskey"></a>Pos.prototype.key</h3><pre><code>key</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>set key for position will change x and y</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>s: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="poseq"></a>Pos.prototype.eq</h3><pre><code>eq(pos: <a href="#pos">Pos</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>compare with a Pos</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code><span> true if pos is equal to this
</span></div></div></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="board"></a>Board</h1><div><p>Game Board a 2 dimensional array to hold integers in each cell</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>cols: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>rows: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>initial: type (=0)</code>: <div style="display:inline-block;" data-radium="true">a interger or function to fill the board
</div></li></div></ol></div><div data-radium="true"><h2 style="text-transform:uppercase;" data-radium="true">instance</h2><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardget"></a>Board.prototype.get</h3><pre><code>get(col: integer, row: integer): integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>col: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>row: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>integer</code><span> content of board cell
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardset"></a>Board.prototype.set</h3><pre><code>set(col: integer, row: integer, val: integer)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>col: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>row: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>val: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardgetpos"></a>Board.prototype.getPos</h3><pre><code>getPos(pos: <a href="#pos">Pos</a>): integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code>integer</code><span>
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardsetpos"></a>Board.prototype.setPos</h3><pre><code>setPos(pos: <a href="#pos">Pos</a>, val: integer)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>val: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardforeach"></a>Board.prototype.forEach</h3><pre><code>forEach(callback: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>iterate through all cells</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>callback: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a></code>: <div style="display:inline-block;" data-radium="true">( item, x, y)
</div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardgethash"></a>Board.prototype.getHash</h3><pre><code>getHash(filter: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>filter: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function">function</a></code>: <div style="display:inline-block;" data-radium="true">= function( {pos,value} ) { return boolean }
</div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code><span> board as object {{pos: {x:0,y:0}, val: 1},..}
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardgetposlist"></a>Board.prototype.getPosList</h3><pre><code>getPosList(value: type): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>value: type</code>: <div style="display:inline-block;" data-radium="true">integer or function(x,y)
</div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code><span> array of Pos of cells contains value
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardfill"></a>Board.prototype.fill</h3><pre><code>fill(value: type)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>value: type</code>: <div style="display:inline-block;" data-radium="true">integer or function(x,y)
</div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardvalidpos"></a>Board.prototype.validPos</h3><pre><code>validPos(pos: <a href="#pos">Pos</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code><span> true if pos is inside board dimensions
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardmove"></a>Board.prototype.move</h3><pre><code>move(fromPos: <a href="#pos">Pos</a>, toPos: <a href="#pos">Pos</a>)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>fromPos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>toPos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardneighbours"></a>Board.prototype.neighbours</h3><pre><code>neighbours(pos: <a href="#pos">Pos</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"></div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>pos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code><span> array of Pos with neigbour cells
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardgetcluster"></a>Board.prototype.getCluster</h3><pre><code>getCluster(startPos: <a href="#pos">Pos</a>, members: integer, exclusive: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Collect positions with neighbours of the same value</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>startPos: <a href="#pos">Pos</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>members: integer</code>: <div style="display:inline-block;" data-radium="true">alternative array of integer
</div></li></div><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>exclusive: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code>: <div style="display:inline-block;" data-radium="true">eclude Pos if true
</div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code><span> array of Pos
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardtostring"></a>Board.prototype.toString</h3><pre><code>toString(): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Return board as string</p>
</div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><span>
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardtostringframed"></a>Board.prototype.toStringFramed</h3><pre><code>toStringFramed(): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Return board as string with frame</p>
</div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><span>
</span></div></div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="boardsetstring"></a>Board.prototype.setString</h3><pre><code>setString(s: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>Set board as string. String must have the same format as toString(). Board size will not change.</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>s: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="triple_fig"></a>TRIPLE_FIG</h1><div><p>triple figure definitions</p>
<p>each figure (object or item) has an integer id. Use the symbols in TRIPLE_FIG.</p>
<p>Figure properties are in 'var figures'.
use function figureProp() to retrieve figure property. Example:
score = figureProp(TRIPLE_FIG.GRASS).score;</p>
</div><div data-radium="true"><div data-radium="true"><h4>Example</h4><pre><code>Figure Id Definitions
EMPTY: <span class="hljs-number">0</span>,
<span class="hljs-attr">GRASS</span>: <span class="hljs-number">1</span>,
<span class="hljs-attr">BUSH</span>: <span class="hljs-number">2</span>,
<span class="hljs-attr">TREE</span>: <span class="hljs-number">3</span>,
<span class="hljs-attr">HUT</span>: <span class="hljs-number">4</span>,
<span class="hljs-attr">HOUSE</span>: <span class="hljs-number">5</span>,
<span class="hljs-attr">MANSION</span>: <span class="hljs-number">6</span>,
<span class="hljs-attr">CASTLE</span>: <span class="hljs-number">7</span>,
<span class="hljs-attr">FLOATINGCASTLE</span>: <span class="hljs-number">8</span>,
<span class="hljs-attr">TRIPLECASTLE</span>: <span class="hljs-number">9</span>,
<span class="hljs-attr">ROCK</span>: <span class="hljs-number">20</span>,
<span class="hljs-attr">MOUNTAIN</span>: <span class="hljs-number">21</span>,
<span class="hljs-attr">ROBOT</span>: <span class="hljs-number">25</span>,
<span class="hljs-attr">CRYSTAL</span>: <span class="hljs-number">26</span>,
<span class="hljs-attr">BEAR</span>: <span class="hljs-number">30</span>,
<span class="hljs-attr">TOMB</span>: <span class="hljs-number">31</span>,
<span class="hljs-attr">NINJA</span>: <span class="hljs-number">32</span>,
<span class="hljs-attr">CHURCH</span>: <span class="hljs-number">40</span>,
<span class="hljs-attr">CATHEDRAL</span>: <span class="hljs-number">41</span>,
<span class="hljs-attr">TREASURE</span>: <span class="hljs-number">50</span>,
<span class="hljs-attr">BIGTREASURE</span>: <span class="hljs-number">51</span>,</code></pre></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figure"></a>Figure</h1><div><p>Figure properties</p>
</div><div data-radium="true"><h2 style="text-transform:uppercase;" data-radium="true">static</h2><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figureid"></a>Figure.id</h3><pre><code>id: iteger</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>TRIPLE_FIG value</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figurekey"></a>Figure.key</h3><pre><code>key: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>key id as string</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figurename"></a>Figure.name</h3><pre><code>name: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>figure name</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figurescore"></a>Figure.score</h3><pre><code>score: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>score for placing</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figuregold"></a>Figure.gold</h3><pre><code>gold: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>used for treasure (optional)</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figuregrowto"></a>Figure.growto</h3><pre><code>growto: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>id of figure to grow to (optional)</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figuredestroyto"></a>Figure.destroyto</h3><pre><code>destroyto: integer</code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>id of figure when it is killed (optional)</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figureimg"></a>Figure.img</h3><pre><code>img: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>name of image file</p>
</div></div><div style="margin-bottom:52px;" data-radium="true"><h3 data-radium="true"><a class="anchor" name="figurecost"></a>Figure.cost</h3><pre><code>cost: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></pre><div style="margin-top:13px;margin-bottom:13px;" data-radium="true"><p>price in shop</p>
</div></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figurelist"></a>figureList</h1><div><p>list of objects with figure properties</p>
</div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figures"></a>figures</h1><div><p>figures is a hash of figureList</p>
</div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figureprop"></a>figureProp</h1><div><p>Get figure by id</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>f: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>: <div style="display:inline-block;" data-radium="true">figure id (key)
</div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="#figure">Figure</a></code><span> figure properties for f
</span></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figurebyid"></a>figureById</h1><div><p>Get figure by id</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>figId: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="#figure">Figure</a></code><span> figure properties for figId
</span></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="figureimgurl"></a>figureImgUrl</h1><div><p>Get image of a figure id</p>
</div><div data-radium="true"><h4>Parameters</h4><ol style="list-style:none;margin-left:0;padding-left:0;" data-radium="true"><div data-radium="true"><li style="padding-bottom:13px;" data-radium="true"><code>figId: integer</code>: <div style="display:inline-block;" data-radium="true"></div></li></div></ol></div><div data-radium="true"><h4>Returns</h4><div data-radium="true"><code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code><span> image name
</span></div></div></div><div style="margin-bottom:104px;" data-radium="true"><h1 data-radium="true"><a class="anchor" name="configlist"></a>configList</h1><div><p>a list of game configurations</p>
</div></div></div></div><div style="clear:both;" data-radium="true"></div></div><div style="clear:both;" data-radium="true"></div></div><style>@media (min-width: 768px) and (max-width: 991px){ .rmq-87b609c0{width: 750px !important;}}
@media (min-width: 992px) and (max-width: 1199px){ .rmq-159a7c96{width: 970px !important;}}
@media (min-width: 1200px){ .rmq-27601239{width: 1170px !important;}}
@media (min-width: 480px) and (max-width: 767px){ .rmq-aa1729d5{float: left !important;}}
@media (min-width: 768px) and (max-width: 991px){ .rmq-a22eaf97{float: left !important;}}
@media (min-width: 992px) and (max-width: 1199px){ .rmq-1918856d{float: left !important;}}
@media (min-width: 1200px){ .rmq-6156e77b{float: left !important;}}
@media (min-width: 480px) and (max-width: 767px) { .rmq-21ab0466{width: 50.00000% !important;}}
@media (min-width: 768px) and (max-width: 991px) { .rmq-a01b93a4{width: 50.00000% !important;}}
@media (min-width: 992px) and (max-width: 1199px) { .rmq-d226cb7e{width: 50.00000% !important;}}
@media (min-width: 1200px) { .rmq-5cc71c8{width: 50.00000% !important;}}
@media (min-width: 480px) and (max-width: 767px) { .rmq-77267d84{width: 25.00000% !important;}}
@media (min-width: 768px) and (max-width: 991px) { .rmq-5c0c1446{width: 25.00000% !important;}}
@media (min-width: 992px) and (max-width: 1199px) { .rmq-4605701c{width: 25.00000% !important;}}
@media (min-width: 1200px) { .rmq-34ee8e6a{width: 25.00000% !important;}}
@media (min-width: 480px) and (max-width: 767px) { .rmq-5c4c5b38{width: 8.33333% !important;}}
@media (max-width: 479px){ .rmq-35757987{display: none !important;}}
@media (min-width: 480px) and (max-width: 767px) { .rmq-f09e82ae{display: none !important;}}
@media (min-width: 480px) and (max-width: 767px) { .rmq-89bb2272{width: 100.00000% !important;}}
@media (min-width: 768px) and (max-width: 991px) { .rmq-2d0e68c6{width: 66.66667% !important;}}
@media (min-width: 992px) and (max-width: 1199px) { .rmq-3752549c{width: 66.66667% !important;}}
@media (min-width: 1200px) { .rmq-3b9282ea{width: 66.66667% !important;}}
@media (min-width: 768px) and (max-width: 991px) { .rmq-4d29a8df{left: 33.33333% !important;}}
@media (min-width: 992px) and (max-width: 1199px) { .rmq-ea7683a5{left: 33.33333% !important;}}
@media (min-width: 1200px) { .rmq-ad95cc33{left: 33.33333% !important;}}</style></div></main></body></html>