tx · 86zLogp142L9QLcmzofDiY4rjneK9LiEMbqXqHsbDrGs 3NB7gYiKko9aybm4jjEFdrTjTsvQWpcCdaS: -0.05000000 Waves 2022.01.26 01:35 [1895045] smart account 3NB7gYiKko9aybm4jjEFdrTjTsvQWpcCdaS > SELF 0.00000000 Waves
{ "type": 13, "id": "86zLogp142L9QLcmzofDiY4rjneK9LiEMbqXqHsbDrGs", "fee": 5000000, "feeAssetId": null, "timestamp": 1643150152643, "version": 2, "chainId": 84, "sender": "3NB7gYiKko9aybm4jjEFdrTjTsvQWpcCdaS", "senderPublicKey": "CMZuFNW2DCrX1xFXYGgE6QrERYLGpncVxcAKhxyEsoAa", "proofs": [ "bVPUKiXDaTA1goaYFHYNRX35btWBqDigwvr9ytYvHYUV59UAKd24ApRGce5Rs8dU4BDCLspM7tSp3r1fWQuufvu" ], "script": "base64:AAIFAAAAAAAAAB0IAhIDCgEIEgMKAQgSBAoCCAgSBAoCCAESAwoBCAAAAAwAAAAADGFkbWluQWRkcmVzcwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAAVhZG1pbgIAAAAAAAAAAAttYWluQWRkcmVzcwkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAABG1haW4CAAAAJEFkZHJlc3Mgb2YgbWFpbiBkQXBwIGlzIG5vdCBkZWZpbmVkIQEAAAAHaXNBZG1pbgAAAAEAAAANY2FsbGVyQWRkcmVzcwMJAAAAAAAAAgUAAAANY2FsbGVyQWRkcmVzcwkAAlkAAAABBQAAAAxhZG1pbkFkZHJlc3MGBwEAAAAGaXNNYWluAAAAAQAAAA1jYWxsZXJBZGRyZXNzAwkAAAAAAAACBQAAAA1jYWxsZXJBZGRyZXNzCQACWQAAAAEFAAAAC21haW5BZGRyZXNzBgcBAAAADHdyaXRlSW50ZWdlcgAAAAIAAAADa2V5AAAADGludGVnZXJWYWx1ZQkBAAAADEludGVnZ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lzQWRtaW4AAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAt3cml0ZVN0cmluZwAAAAIFAAAAA2tleQUAAAALc3RyaW5nVmFsdWUFAAAAA25pbAkAAAIAAAABAgAAACpBZGRyZXNzIGRvZXMgbm90IG1hdGNoIHdpdGggYWRtaW4gYWRkcmVzcyEAAAABaQEAAAASdXBkYXRlSW50ZWdlckVudHJ5AAAAAgAAAANrZXkAAAAMaW50ZWdlclZhbHVlAwkBAAAAB2lzQWRtaW4AAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAx3cml0ZUludGVnZXIAAAACBQAAAANrZXkFAAAADGludGVnZXJWYWx1ZQUAAAADbmlsCQAAAgAAAAECAAAAKkFkZHJlc3MgZG9lcyBub3QgbWF0Y2ggd2l0aCBhZG1pbiBhZGRyZXNzIQAAAAFpAQAAABJkZWxldGVTdG9yYWdlRW50cnkAAAABAAAAA2tleQMJAQAAAAdpc0FkbWluAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAANrZXkFAAAAA25pbAkAAAIAAAABAgAAACpBZGRyZXNzIGRvZXMgbm90IG1hdGNoIHdpdGggYWRtaW4gYWRkcmVzcyEAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleajEcZY=", "height": 1895045, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CGobikNVzPpL5pwBeXERorsdL4a2scP7oqEweJgPLJ7 Next: BVzg95uhLAb6LyG6W37EWu4qLoZ45H7SzhnuZneBvkdG Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminAddress = valueOrElse(getString(this, "admin"), "") | |
5 | 5 | ||
6 | + | let mainAddress = valueOrErrorMessage(getString(this, "main"), "Address of main dApp is not defined!") | |
7 | + | ||
6 | 8 | func isAdmin (callerAddress) = if ((callerAddress == fromBase58String(adminAddress))) | |
9 | + | then true | |
10 | + | else false | |
11 | + | ||
12 | + | ||
13 | + | func isMain (callerAddress) = if ((callerAddress == fromBase58String(mainAddress))) | |
7 | 14 | then true | |
8 | 15 | else false | |
9 | 16 | ||
12 | 19 | ||
13 | 20 | ||
14 | 21 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
22 | + | ||
23 | + | ||
24 | + | func createMultiDimBoard (board) = { | |
25 | + | let startIdxs = [0, 7, 14, 21, 28, 35] | |
26 | + | let placeholder = [0, 0, 0, 0, 0, 0, 0] | |
27 | + | func foldBoard (accum,next) = { | |
28 | + | func setRow (accumSecond,nextSecond) = { | |
29 | + | let $t020372066 = accumSecond | |
30 | + | let result = $t020372066._1 | |
31 | + | let j = $t020372066._2 | |
32 | + | $Tuple2((result :+ board[(next + j)]), (j + 1)) | |
33 | + | } | |
34 | + | ||
35 | + | let row = { | |
36 | + | let $l = placeholder | |
37 | + | let $s = size($l) | |
38 | + | let $acc0 = $Tuple2(nil, 0) | |
39 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
40 | + | then $a | |
41 | + | else setRow($a, $l[$i]) | |
42 | + | ||
43 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
44 | + | then $a | |
45 | + | else throw("List size exceeds 7") | |
46 | + | ||
47 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
48 | + | } | |
49 | + | (accum :+ row._1) | |
50 | + | } | |
51 | + | ||
52 | + | let $l = startIdxs | |
53 | + | let $s = size($l) | |
54 | + | let $acc0 = nil | |
55 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
56 | + | then $a | |
57 | + | else foldBoard($a, $l[$i]) | |
58 | + | ||
59 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
60 | + | then $a | |
61 | + | else throw("List size exceeds 6") | |
62 | + | ||
63 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func checkVerticalWin (multiBoard) = { | |
68 | + | let rowIdxs = [3, 4, 5] | |
69 | + | let colIdxs = [0, 1, 2, 3, 4, 5, 6] | |
70 | + | func foldRows (accum,next) = { | |
71 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
72 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][nextSecond])) | |
73 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][nextSecond]) | |
74 | + | else false) | |
75 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][nextSecond]) | |
76 | + | else false) | |
77 | + | then (accum :+ multiBoard[next][nextSecond]) | |
78 | + | else (accumSecond :+ "") | |
79 | + | else (accumSecond :+ "") | |
80 | + | ||
81 | + | (accum ++ { | |
82 | + | let $l = colIdxs | |
83 | + | let $s = size($l) | |
84 | + | let $acc0 = nil | |
85 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
86 | + | then $a | |
87 | + | else foldCols($a, $l[$i]) | |
88 | + | ||
89 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
90 | + | then $a | |
91 | + | else throw("List size exceeds 7") | |
92 | + | ||
93 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
94 | + | }) | |
95 | + | } | |
96 | + | ||
97 | + | let resultArray = { | |
98 | + | let $l = rowIdxs | |
99 | + | let $s = size($l) | |
100 | + | let $acc0 = nil | |
101 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | + | then $a | |
103 | + | else foldRows($a, $l[$i]) | |
104 | + | ||
105 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | + | then $a | |
107 | + | else throw("List size exceeds 3") | |
108 | + | ||
109 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
110 | + | } | |
111 | + | let result = if (containsElement(resultArray, "B")) | |
112 | + | then "teamBlue" | |
113 | + | else if (containsElement(resultArray, "Y")) | |
114 | + | then "teamYellow" | |
115 | + | else "" | |
116 | + | result | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | func checkHorizontalWin (multiBoard) = { | |
121 | + | let rowIdxs = [0, 1, 2, 3, 4, 5] | |
122 | + | let colIdxs = [0, 1, 2, 3] | |
123 | + | func foldRows (accum,next) = { | |
124 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
125 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 1)])) | |
126 | + | then (multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 2)]) | |
127 | + | else false) | |
128 | + | then (multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 3)]) | |
129 | + | else false) | |
130 | + | then (accum :+ multiBoard[next][nextSecond]) | |
131 | + | else (accumSecond :+ "") | |
132 | + | else (accumSecond :+ "") | |
133 | + | ||
134 | + | (accum ++ { | |
135 | + | let $l = colIdxs | |
136 | + | let $s = size($l) | |
137 | + | let $acc0 = nil | |
138 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
139 | + | then $a | |
140 | + | else foldCols($a, $l[$i]) | |
141 | + | ||
142 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
143 | + | then $a | |
144 | + | else throw("List size exceeds 4") | |
145 | + | ||
146 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
147 | + | }) | |
148 | + | } | |
149 | + | ||
150 | + | let resultArray = { | |
151 | + | let $l = rowIdxs | |
152 | + | let $s = size($l) | |
153 | + | let $acc0 = nil | |
154 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
155 | + | then $a | |
156 | + | else foldRows($a, $l[$i]) | |
157 | + | ||
158 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
159 | + | then $a | |
160 | + | else throw("List size exceeds 6") | |
161 | + | ||
162 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
163 | + | } | |
164 | + | let result = if (containsElement(resultArray, "B")) | |
165 | + | then "teamBlue" | |
166 | + | else if (containsElement(resultArray, "Y")) | |
167 | + | then "teamYellow" | |
168 | + | else "" | |
169 | + | result | |
170 | + | } | |
171 | + | ||
172 | + | ||
173 | + | func checkDiagonalRightWin (multiBoard) = { | |
174 | + | let rowIdxs = [3, 4, 5] | |
175 | + | let colIdxs = [0, 1, 2] | |
176 | + | func foldRows (accum,next) = { | |
177 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
178 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][(nextSecond + 1)])) | |
179 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][(nextSecond + 2)]) | |
180 | + | else false) | |
181 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][(nextSecond + 3)]) | |
182 | + | else false) | |
183 | + | then (accum :+ multiBoard[next][nextSecond]) | |
184 | + | else (accumSecond :+ "") | |
185 | + | else (accumSecond :+ "") | |
186 | + | ||
187 | + | (accum ++ { | |
188 | + | let $l = colIdxs | |
189 | + | let $s = size($l) | |
190 | + | let $acc0 = nil | |
191 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
192 | + | then $a | |
193 | + | else foldCols($a, $l[$i]) | |
194 | + | ||
195 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
196 | + | then $a | |
197 | + | else throw("List size exceeds 3") | |
198 | + | ||
199 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
200 | + | }) | |
201 | + | } | |
202 | + | ||
203 | + | let resultArray = { | |
204 | + | let $l = rowIdxs | |
205 | + | let $s = size($l) | |
206 | + | let $acc0 = nil | |
207 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
208 | + | then $a | |
209 | + | else foldRows($a, $l[$i]) | |
210 | + | ||
211 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
212 | + | then $a | |
213 | + | else throw("List size exceeds 3") | |
214 | + | ||
215 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
216 | + | } | |
217 | + | let result = if (containsElement(resultArray, "B")) | |
218 | + | then "teamBlue" | |
219 | + | else if (containsElement(resultArray, "Y")) | |
220 | + | then "teamYellow" | |
221 | + | else "" | |
222 | + | result | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | func checkDiagonalLeftWin (multiBoard) = { | |
227 | + | let rowIdxs = [3, 4, 5] | |
228 | + | let colIdxs = [3, 4, 5, 6] | |
229 | + | func foldRows (accum,next) = { | |
230 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
231 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][(nextSecond - 1)])) | |
232 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][(nextSecond - 2)]) | |
233 | + | else false) | |
234 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][(nextSecond - 3)]) | |
235 | + | else false) | |
236 | + | then (accum :+ multiBoard[next][nextSecond]) | |
237 | + | else (accumSecond :+ "") | |
238 | + | else (accumSecond :+ "") | |
239 | + | ||
240 | + | (accum ++ { | |
241 | + | let $l = colIdxs | |
242 | + | let $s = size($l) | |
243 | + | let $acc0 = nil | |
244 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
245 | + | then $a | |
246 | + | else foldCols($a, $l[$i]) | |
247 | + | ||
248 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
249 | + | then $a | |
250 | + | else throw("List size exceeds 4") | |
251 | + | ||
252 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
253 | + | }) | |
254 | + | } | |
255 | + | ||
256 | + | let resultArray = { | |
257 | + | let $l = rowIdxs | |
258 | + | let $s = size($l) | |
259 | + | let $acc0 = nil | |
260 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
261 | + | then $a | |
262 | + | else foldRows($a, $l[$i]) | |
263 | + | ||
264 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
265 | + | then $a | |
266 | + | else throw("List size exceeds 3") | |
267 | + | ||
268 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
269 | + | } | |
270 | + | let result = if (containsElement(resultArray, "B")) | |
271 | + | then "teamBlue" | |
272 | + | else if (containsElement(resultArray, "Y")) | |
273 | + | then "teamYellow" | |
274 | + | else "" | |
275 | + | result | |
276 | + | } | |
277 | + | ||
278 | + | ||
279 | + | func checkDraw (multiBoard) = { | |
280 | + | let rowIdxs = [0, 1, 2, 3, 4, 5] | |
281 | + | let colIdxs = [0, 1, 2, 3, 4, 5, 6] | |
282 | + | func foldRows (accum,next) = { | |
283 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
284 | + | then (accumSecond :+ "D") | |
285 | + | else (accumSecond :+ "") | |
286 | + | ||
287 | + | (accum ++ { | |
288 | + | let $l = colIdxs | |
289 | + | let $s = size($l) | |
290 | + | let $acc0 = nil | |
291 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
292 | + | then $a | |
293 | + | else foldCols($a, $l[$i]) | |
294 | + | ||
295 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else throw("List size exceeds 7") | |
298 | + | ||
299 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
300 | + | }) | |
301 | + | } | |
302 | + | ||
303 | + | let resultArray = { | |
304 | + | let $l = rowIdxs | |
305 | + | let $s = size($l) | |
306 | + | let $acc0 = nil | |
307 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
308 | + | then $a | |
309 | + | else foldRows($a, $l[$i]) | |
310 | + | ||
311 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
312 | + | then $a | |
313 | + | else throw("List size exceeds 6") | |
314 | + | ||
315 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
316 | + | } | |
317 | + | let result = if (containsElement(resultArray, "")) | |
318 | + | then "" | |
319 | + | else "draw" | |
320 | + | result | |
321 | + | } | |
322 | + | ||
323 | + | ||
324 | + | @Callable(i) | |
325 | + | func checkForWin (board) = if (isMain(i.caller.bytes)) | |
326 | + | then { | |
327 | + | let oneDimBoard = split(board, ",") | |
328 | + | let multiDimBoard = createMultiDimBoard(oneDimBoard) | |
329 | + | let potentialVerticalWinner = checkVerticalWin(multiDimBoard) | |
330 | + | let potentialHorizontalWinner = checkHorizontalWin(multiDimBoard) | |
331 | + | let potentialDiagonalRightWinner = checkDiagonalRightWin(multiDimBoard) | |
332 | + | let potentialDiagonalLeftWinner = checkDiagonalLeftWin(multiDimBoard) | |
333 | + | let potentialDraw = checkDraw(multiDimBoard) | |
334 | + | let result = if ((potentialVerticalWinner != "")) | |
335 | + | then potentialVerticalWinner | |
336 | + | else if ((potentialDiagonalRightWinner != "")) | |
337 | + | then potentialDiagonalRightWinner | |
338 | + | else if ((potentialDiagonalLeftWinner != "")) | |
339 | + | then potentialDiagonalLeftWinner | |
340 | + | else if ((potentialHorizontalWinner != "")) | |
341 | + | then potentialHorizontalWinner | |
342 | + | else if ((potentialDraw != "")) | |
343 | + | then potentialDraw | |
344 | + | else "" | |
345 | + | $Tuple2(nil, result) | |
346 | + | } | |
347 | + | else throw("Caller is not main dApp!") | |
348 | + | ||
15 | 349 | ||
16 | 350 | ||
17 | 351 | @Callable(i) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminAddress = valueOrElse(getString(this, "admin"), "") | |
5 | 5 | ||
6 | + | let mainAddress = valueOrErrorMessage(getString(this, "main"), "Address of main dApp is not defined!") | |
7 | + | ||
6 | 8 | func isAdmin (callerAddress) = if ((callerAddress == fromBase58String(adminAddress))) | |
9 | + | then true | |
10 | + | else false | |
11 | + | ||
12 | + | ||
13 | + | func isMain (callerAddress) = if ((callerAddress == fromBase58String(mainAddress))) | |
7 | 14 | then true | |
8 | 15 | else false | |
9 | 16 | ||
10 | 17 | ||
11 | 18 | func writeInteger (key,integerValue) = IntegerEntry(key, integerValue) | |
12 | 19 | ||
13 | 20 | ||
14 | 21 | func writeString (key,stringValue) = StringEntry(key, stringValue) | |
22 | + | ||
23 | + | ||
24 | + | func createMultiDimBoard (board) = { | |
25 | + | let startIdxs = [0, 7, 14, 21, 28, 35] | |
26 | + | let placeholder = [0, 0, 0, 0, 0, 0, 0] | |
27 | + | func foldBoard (accum,next) = { | |
28 | + | func setRow (accumSecond,nextSecond) = { | |
29 | + | let $t020372066 = accumSecond | |
30 | + | let result = $t020372066._1 | |
31 | + | let j = $t020372066._2 | |
32 | + | $Tuple2((result :+ board[(next + j)]), (j + 1)) | |
33 | + | } | |
34 | + | ||
35 | + | let row = { | |
36 | + | let $l = placeholder | |
37 | + | let $s = size($l) | |
38 | + | let $acc0 = $Tuple2(nil, 0) | |
39 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
40 | + | then $a | |
41 | + | else setRow($a, $l[$i]) | |
42 | + | ||
43 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
44 | + | then $a | |
45 | + | else throw("List size exceeds 7") | |
46 | + | ||
47 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
48 | + | } | |
49 | + | (accum :+ row._1) | |
50 | + | } | |
51 | + | ||
52 | + | let $l = startIdxs | |
53 | + | let $s = size($l) | |
54 | + | let $acc0 = nil | |
55 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
56 | + | then $a | |
57 | + | else foldBoard($a, $l[$i]) | |
58 | + | ||
59 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
60 | + | then $a | |
61 | + | else throw("List size exceeds 6") | |
62 | + | ||
63 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func checkVerticalWin (multiBoard) = { | |
68 | + | let rowIdxs = [3, 4, 5] | |
69 | + | let colIdxs = [0, 1, 2, 3, 4, 5, 6] | |
70 | + | func foldRows (accum,next) = { | |
71 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
72 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][nextSecond])) | |
73 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][nextSecond]) | |
74 | + | else false) | |
75 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][nextSecond]) | |
76 | + | else false) | |
77 | + | then (accum :+ multiBoard[next][nextSecond]) | |
78 | + | else (accumSecond :+ "") | |
79 | + | else (accumSecond :+ "") | |
80 | + | ||
81 | + | (accum ++ { | |
82 | + | let $l = colIdxs | |
83 | + | let $s = size($l) | |
84 | + | let $acc0 = nil | |
85 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
86 | + | then $a | |
87 | + | else foldCols($a, $l[$i]) | |
88 | + | ||
89 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
90 | + | then $a | |
91 | + | else throw("List size exceeds 7") | |
92 | + | ||
93 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
94 | + | }) | |
95 | + | } | |
96 | + | ||
97 | + | let resultArray = { | |
98 | + | let $l = rowIdxs | |
99 | + | let $s = size($l) | |
100 | + | let $acc0 = nil | |
101 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
102 | + | then $a | |
103 | + | else foldRows($a, $l[$i]) | |
104 | + | ||
105 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
106 | + | then $a | |
107 | + | else throw("List size exceeds 3") | |
108 | + | ||
109 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
110 | + | } | |
111 | + | let result = if (containsElement(resultArray, "B")) | |
112 | + | then "teamBlue" | |
113 | + | else if (containsElement(resultArray, "Y")) | |
114 | + | then "teamYellow" | |
115 | + | else "" | |
116 | + | result | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | func checkHorizontalWin (multiBoard) = { | |
121 | + | let rowIdxs = [0, 1, 2, 3, 4, 5] | |
122 | + | let colIdxs = [0, 1, 2, 3] | |
123 | + | func foldRows (accum,next) = { | |
124 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
125 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 1)])) | |
126 | + | then (multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 2)]) | |
127 | + | else false) | |
128 | + | then (multiBoard[next][nextSecond] == multiBoard[next][(nextSecond + 3)]) | |
129 | + | else false) | |
130 | + | then (accum :+ multiBoard[next][nextSecond]) | |
131 | + | else (accumSecond :+ "") | |
132 | + | else (accumSecond :+ "") | |
133 | + | ||
134 | + | (accum ++ { | |
135 | + | let $l = colIdxs | |
136 | + | let $s = size($l) | |
137 | + | let $acc0 = nil | |
138 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
139 | + | then $a | |
140 | + | else foldCols($a, $l[$i]) | |
141 | + | ||
142 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
143 | + | then $a | |
144 | + | else throw("List size exceeds 4") | |
145 | + | ||
146 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
147 | + | }) | |
148 | + | } | |
149 | + | ||
150 | + | let resultArray = { | |
151 | + | let $l = rowIdxs | |
152 | + | let $s = size($l) | |
153 | + | let $acc0 = nil | |
154 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
155 | + | then $a | |
156 | + | else foldRows($a, $l[$i]) | |
157 | + | ||
158 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
159 | + | then $a | |
160 | + | else throw("List size exceeds 6") | |
161 | + | ||
162 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
163 | + | } | |
164 | + | let result = if (containsElement(resultArray, "B")) | |
165 | + | then "teamBlue" | |
166 | + | else if (containsElement(resultArray, "Y")) | |
167 | + | then "teamYellow" | |
168 | + | else "" | |
169 | + | result | |
170 | + | } | |
171 | + | ||
172 | + | ||
173 | + | func checkDiagonalRightWin (multiBoard) = { | |
174 | + | let rowIdxs = [3, 4, 5] | |
175 | + | let colIdxs = [0, 1, 2] | |
176 | + | func foldRows (accum,next) = { | |
177 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
178 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][(nextSecond + 1)])) | |
179 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][(nextSecond + 2)]) | |
180 | + | else false) | |
181 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][(nextSecond + 3)]) | |
182 | + | else false) | |
183 | + | then (accum :+ multiBoard[next][nextSecond]) | |
184 | + | else (accumSecond :+ "") | |
185 | + | else (accumSecond :+ "") | |
186 | + | ||
187 | + | (accum ++ { | |
188 | + | let $l = colIdxs | |
189 | + | let $s = size($l) | |
190 | + | let $acc0 = nil | |
191 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
192 | + | then $a | |
193 | + | else foldCols($a, $l[$i]) | |
194 | + | ||
195 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
196 | + | then $a | |
197 | + | else throw("List size exceeds 3") | |
198 | + | ||
199 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
200 | + | }) | |
201 | + | } | |
202 | + | ||
203 | + | let resultArray = { | |
204 | + | let $l = rowIdxs | |
205 | + | let $s = size($l) | |
206 | + | let $acc0 = nil | |
207 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
208 | + | then $a | |
209 | + | else foldRows($a, $l[$i]) | |
210 | + | ||
211 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
212 | + | then $a | |
213 | + | else throw("List size exceeds 3") | |
214 | + | ||
215 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
216 | + | } | |
217 | + | let result = if (containsElement(resultArray, "B")) | |
218 | + | then "teamBlue" | |
219 | + | else if (containsElement(resultArray, "Y")) | |
220 | + | then "teamYellow" | |
221 | + | else "" | |
222 | + | result | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | func checkDiagonalLeftWin (multiBoard) = { | |
227 | + | let rowIdxs = [3, 4, 5] | |
228 | + | let colIdxs = [3, 4, 5, 6] | |
229 | + | func foldRows (accum,next) = { | |
230 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
231 | + | then if (if (if ((multiBoard[next][nextSecond] == multiBoard[(next - 1)][(nextSecond - 1)])) | |
232 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 2)][(nextSecond - 2)]) | |
233 | + | else false) | |
234 | + | then (multiBoard[next][nextSecond] == multiBoard[(next - 3)][(nextSecond - 3)]) | |
235 | + | else false) | |
236 | + | then (accum :+ multiBoard[next][nextSecond]) | |
237 | + | else (accumSecond :+ "") | |
238 | + | else (accumSecond :+ "") | |
239 | + | ||
240 | + | (accum ++ { | |
241 | + | let $l = colIdxs | |
242 | + | let $s = size($l) | |
243 | + | let $acc0 = nil | |
244 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
245 | + | then $a | |
246 | + | else foldCols($a, $l[$i]) | |
247 | + | ||
248 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
249 | + | then $a | |
250 | + | else throw("List size exceeds 4") | |
251 | + | ||
252 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4) | |
253 | + | }) | |
254 | + | } | |
255 | + | ||
256 | + | let resultArray = { | |
257 | + | let $l = rowIdxs | |
258 | + | let $s = size($l) | |
259 | + | let $acc0 = nil | |
260 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
261 | + | then $a | |
262 | + | else foldRows($a, $l[$i]) | |
263 | + | ||
264 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
265 | + | then $a | |
266 | + | else throw("List size exceeds 3") | |
267 | + | ||
268 | + | $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3) | |
269 | + | } | |
270 | + | let result = if (containsElement(resultArray, "B")) | |
271 | + | then "teamBlue" | |
272 | + | else if (containsElement(resultArray, "Y")) | |
273 | + | then "teamYellow" | |
274 | + | else "" | |
275 | + | result | |
276 | + | } | |
277 | + | ||
278 | + | ||
279 | + | func checkDraw (multiBoard) = { | |
280 | + | let rowIdxs = [0, 1, 2, 3, 4, 5] | |
281 | + | let colIdxs = [0, 1, 2, 3, 4, 5, 6] | |
282 | + | func foldRows (accum,next) = { | |
283 | + | func foldCols (accumSecond,nextSecond) = if ((multiBoard[next][nextSecond] != "0")) | |
284 | + | then (accumSecond :+ "D") | |
285 | + | else (accumSecond :+ "") | |
286 | + | ||
287 | + | (accum ++ { | |
288 | + | let $l = colIdxs | |
289 | + | let $s = size($l) | |
290 | + | let $acc0 = nil | |
291 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
292 | + | then $a | |
293 | + | else foldCols($a, $l[$i]) | |
294 | + | ||
295 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else throw("List size exceeds 7") | |
298 | + | ||
299 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
300 | + | }) | |
301 | + | } | |
302 | + | ||
303 | + | let resultArray = { | |
304 | + | let $l = rowIdxs | |
305 | + | let $s = size($l) | |
306 | + | let $acc0 = nil | |
307 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
308 | + | then $a | |
309 | + | else foldRows($a, $l[$i]) | |
310 | + | ||
311 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
312 | + | then $a | |
313 | + | else throw("List size exceeds 6") | |
314 | + | ||
315 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
316 | + | } | |
317 | + | let result = if (containsElement(resultArray, "")) | |
318 | + | then "" | |
319 | + | else "draw" | |
320 | + | result | |
321 | + | } | |
322 | + | ||
323 | + | ||
324 | + | @Callable(i) | |
325 | + | func checkForWin (board) = if (isMain(i.caller.bytes)) | |
326 | + | then { | |
327 | + | let oneDimBoard = split(board, ",") | |
328 | + | let multiDimBoard = createMultiDimBoard(oneDimBoard) | |
329 | + | let potentialVerticalWinner = checkVerticalWin(multiDimBoard) | |
330 | + | let potentialHorizontalWinner = checkHorizontalWin(multiDimBoard) | |
331 | + | let potentialDiagonalRightWinner = checkDiagonalRightWin(multiDimBoard) | |
332 | + | let potentialDiagonalLeftWinner = checkDiagonalLeftWin(multiDimBoard) | |
333 | + | let potentialDraw = checkDraw(multiDimBoard) | |
334 | + | let result = if ((potentialVerticalWinner != "")) | |
335 | + | then potentialVerticalWinner | |
336 | + | else if ((potentialDiagonalRightWinner != "")) | |
337 | + | then potentialDiagonalRightWinner | |
338 | + | else if ((potentialDiagonalLeftWinner != "")) | |
339 | + | then potentialDiagonalLeftWinner | |
340 | + | else if ((potentialHorizontalWinner != "")) | |
341 | + | then potentialHorizontalWinner | |
342 | + | else if ((potentialDraw != "")) | |
343 | + | then potentialDraw | |
344 | + | else "" | |
345 | + | $Tuple2(nil, result) | |
346 | + | } | |
347 | + | else throw("Caller is not main dApp!") | |
348 | + | ||
15 | 349 | ||
16 | 350 | ||
17 | 351 | @Callable(i) | |
18 | 352 | func setup (mainAddress) = if (!(isDefined(getString(this, "admin")))) | |
19 | 353 | then [writeString("admin", toBase58String(i.caller.bytes)), writeString("main", mainAddress)] | |
20 | 354 | else throw("DApp already setup!") | |
21 | 355 | ||
22 | 356 | ||
23 | 357 | ||
24 | 358 | @Callable(i) | |
25 | 359 | func updateStringEntry (key,stringValue) = if (isAdmin(i.caller.bytes)) | |
26 | 360 | then [writeString(key, stringValue)] | |
27 | 361 | else throw("Address does not match with admin address!") | |
28 | 362 | ||
29 | 363 | ||
30 | 364 | ||
31 | 365 | @Callable(i) | |
32 | 366 | func updateIntegerEntry (key,integerValue) = if (isAdmin(i.caller.bytes)) | |
33 | 367 | then [writeInteger(key, integerValue)] | |
34 | 368 | else throw("Address does not match with admin address!") | |
35 | 369 | ||
36 | 370 | ||
37 | 371 | ||
38 | 372 | @Callable(i) | |
39 | 373 | func deleteStorageEntry (key) = if (isAdmin(i.caller.bytes)) | |
40 | 374 | then [DeleteEntry(key)] | |
41 | 375 | else throw("Address does not match with admin address!") | |
42 | 376 | ||
43 | 377 | ||
44 | 378 | @Verifier(tx) | |
45 | 379 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
46 | 380 |
github/deemru/w8io/169f3d6 48.64 ms ◑