tx · 2URw7ejtraUMULn9edyFDf6czJZNQUW6kntN4xKVjojP 3Mth4mJpNbm6N6PQsgnP5KzcHBfC2Luiyfs: -0.01400000 Waves 2019.07.31 19:46 [610529] smart account 3Mth4mJpNbm6N6PQsgnP5KzcHBfC2Luiyfs > SELF 0.00000000 Waves
{ "type": 13, "id": "2URw7ejtraUMULn9edyFDf6czJZNQUW6kntN4xKVjojP", "fee": 1400000, "feeAssetId": null, "timestamp": 1564591645911, "version": 1, "sender": "3Mth4mJpNbm6N6PQsgnP5KzcHBfC2Luiyfs", "senderPublicKey": "GL5QvqgydTUCg1sj1s7juR6hVfxLHjZ37Kr5sAX4D4an", "proofs": [ "4Hmx6EtCiH3P5H5yuXtppCVxLaEJL63uTwUF3Erb1SQsELJELDr6m7wysUABZPhLYP9MBMawYxUE6Je51roNVhax" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAQAAAAlmaXZlQ2hhcnMAAAABAAAAAWMJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAABYwUAAAABYwUAAAABYwUAAAABYwUAAAABYwEAAAAEY2VsbAAAAAMAAAAFY2VsbHMAAAADcm93AAAAA2NvbAkBAAAACXRha2VSaWdodAAAAAIJAAEvAAAAAgUAAAAFY2VsbHMJAABkAAAAAgkAAGQAAAACCQAAaAAAAAIFAAAAA3JvdwAAAAAAAAAADwUAAAADY29sAAAAAAAAAAABAAAAAAAAAAABAQAAAAdzZXRDZWxsAAAABAAAAAVjZWxscwAAAANyb3cAAAADY29sAAAAA3ZhbAkAASwAAAACCQABLAAAAAIJAAEvAAAAAgUAAAAFY2VsbHMJAABkAAAAAgkAAGgAAAACBQAAAANyb3cAAAAAAAAAAA8FAAAAA2NvbAUAAAADdmFsCQEAAAAJdGFrZVJpZ2h0AAAAAgUAAAAFY2VsbHMJAABlAAAAAgkAATEAAAABBQAAAAVjZWxscwkAAGQAAAACCQAAZAAAAAIJAABoAAAAAgUAAAADcm93AAAAAAAAAAAPBQAAAAN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AQUAAAAEZ2FtZQIAAAAGX2NlbGxzCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABpQAAAAEJAQAAAAtjaGVja0ZpZWxkQgAAAAMFAAAABWNlbGxzBQAAAANyb3cFAAAAA2NvbAIAAAACLCAJAAGlAAAAAQkBAAAAC2NoZWNrRmllbGRXAAAAAwUAAAAFY2VsbHMFAAAAA3JvdwUAAAADY29sAAAAAWkBAAAAC3Rlc3RTZXRDZWxsAAAABAAAAARnYW1lAAAAA3JvdwAAAANjb2wAAAADdmFsBAAAAAVjZWxscwkBAAAAB2V4dHJhY3QAAAABCQAEHQAAAAIFAAAABHRoaXMJAAEsAAAAAgkAASwAAAACAgAAAAVnYW1lOgkAAaQAAAABBQAAAARnYW1lAgAAAAZfY2VsbHMEAAAACG5ld0NlbGxzCQEAAAAHc2V0Q2VsbAAAAAQFAAAABWNlbGxzBQAAAANyb3cFAAAAA2NvbAUAAAADdmFsCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAFZ2FtZToJAAGkAAAAAQUAAAAEZ2FtZQIAAAAGX2NlbGxzBQAAAAhuZXdDZWxscwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAYGBoJv", "chainId": 84, "height": 610529, "spentComplexity": 0 } View: original | compacted Prev: Ak3tnHVv23gpDBkCXy8WDUkaeTHuUa88eBr1A8jMBmoY Next: FNwy9JfPJ3PBDbvLbhjFTLNwL9HmVeBDSdKpq1YyVswv Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | ||
9 | 9 | ||
10 | 10 | func setCell (cells,row,col,val) = ((take(cells, ((row * 15) + col)) + val) + takeRight(cells, (size(cells) - (((row * 15) + col) + 1)))) | |
11 | - | ||
12 | - | ||
13 | - | func row (cells,row) = ((((((((((((((cell(cells, row, 0) + cell(cells, row, 1)) + cell(cells, row, 2)) + cell(cells, row, 3)) + cell(cells, row, 4)) + cell(cells, row, 5)) + cell(cells, row, 6)) + cell(cells, row, 7)) + cell(cells, row, 8)) + cell(cells, row, 9)) + cell(cells, row, 10)) + cell(cells, row, 11)) + cell(cells, row, 12)) + cell(cells, row, 13)) + cell(cells, row, 14)) | |
14 | - | ||
15 | - | ||
16 | - | func column (cells,col) = ((((((((((((((cell(cells, 0, col) + cell(cells, 1, col)) + cell(cells, 2, col)) + cell(cells, 3, col)) + cell(cells, 4, col)) + cell(cells, 5, col)) + cell(cells, 6, col)) + cell(cells, 7, col)) + cell(cells, 8, col)) + cell(cells, 9, col)) + cell(cells, 10, col)) + cell(cells, 11, col)) + cell(cells, 12, col)) + cell(cells, 13, col)) + cell(cells, 14, col)) | |
17 | - | ||
18 | - | ||
19 | - | func diagHelper (cells,d,dir,i) = if ((dir == "R")) | |
20 | - | then if (if ((d >= i)) | |
21 | - | then ((14 + i) >= d) | |
22 | - | else false) | |
23 | - | then cell(cells, i, (d - i)) | |
24 | - | else "" | |
25 | - | else if ((dir == "L")) | |
26 | - | then if (if ((d >= i)) | |
27 | - | then ((14 + i) >= d) | |
28 | - | else false) | |
29 | - | then cell(cells, (d - i), (14 - i)) | |
30 | - | else "" | |
31 | - | else throw("invalid dir in diagHelper function") | |
32 | - | ||
33 | - | ||
34 | - | func diag (cells,d,dir) = ((((((((((((((diagHelper(cells, d, dir, 14) + diagHelper(cells, d, dir, 13)) + diagHelper(cells, d, dir, 12)) + diagHelper(cells, d, dir, 11)) + diagHelper(cells, d, dir, 10)) + diagHelper(cells, d, dir, 9)) + diagHelper(cells, d, dir, 8)) + diagHelper(cells, d, dir, 7)) + diagHelper(cells, d, dir, 6)) + diagHelper(cells, d, dir, 5)) + diagHelper(cells, d, dir, 4)) + diagHelper(cells, d, dir, 3)) + diagHelper(cells, d, dir, 2)) + diagHelper(cells, d, dir, 1)) + diagHelper(cells, d, dir, 0)) | |
35 | 11 | ||
36 | 12 | ||
37 | 13 | func check (line,c) = if (if ((c != "b")) | |
46 | 22 | } | |
47 | 23 | ||
48 | 24 | ||
25 | + | func getRow (cells,row,col) = if ((col >= 4)) | |
26 | + | then cell(cells, row, (col - 4)) | |
27 | + | else ("" + (if ((col >= 3)) | |
28 | + | then cell(cells, row, (col - 3)) | |
29 | + | else ("" + (if ((col >= 2)) | |
30 | + | then cell(cells, row, (col - 2)) | |
31 | + | else ("" + (if ((col >= 1)) | |
32 | + | then cell(cells, row, (col - 1)) | |
33 | + | else (("" + cell(cells, row, col)) + (if ((13 >= col)) | |
34 | + | then cell(cells, row, (col + 1)) | |
35 | + | else ("" + (if ((12 >= col)) | |
36 | + | then cell(cells, row, (col + 2)) | |
37 | + | else ("" + (if ((11 >= col)) | |
38 | + | then cell(cells, row, (col + 3)) | |
39 | + | else ("" + (if ((10 >= col)) | |
40 | + | then cell(cells, row, (col + 4)) | |
41 | + | else "")))))))))))))) | |
42 | + | ||
43 | + | ||
44 | + | func getColumn (cells,row,col) = if ((row >= 4)) | |
45 | + | then cell(cells, (row - 4), col) | |
46 | + | else ("" + (if ((row >= 3)) | |
47 | + | then cell(cells, (row - 3), col) | |
48 | + | else ("" + (if ((row >= 2)) | |
49 | + | then cell(cells, (row - 2), col) | |
50 | + | else ("" + (if ((row >= 1)) | |
51 | + | then cell(cells, (row - 1), col) | |
52 | + | else (("" + cell(cells, row, col)) + (if ((13 >= row)) | |
53 | + | then cell(cells, (row + 1), col) | |
54 | + | else ("" + (if ((12 >= row)) | |
55 | + | then cell(cells, (row + 2), col) | |
56 | + | else ("" + (if ((11 >= row)) | |
57 | + | then cell(cells, (row + 3), col) | |
58 | + | else ("" + (if ((10 >= row)) | |
59 | + | then cell(cells, (row + 4), col) | |
60 | + | else "")))))))))))))) | |
61 | + | ||
62 | + | ||
63 | + | func getRDiag (cells,row,col) = if (if ((row >= 4)) | |
64 | + | then (10 >= col) | |
65 | + | else false) | |
66 | + | then cell(cells, (row - 4), (col + 4)) | |
67 | + | else ("" + (if (if ((row >= 3)) | |
68 | + | then (11 >= col) | |
69 | + | else false) | |
70 | + | then cell(cells, (row - 3), (col + 3)) | |
71 | + | else ("" + (if (if ((row >= 2)) | |
72 | + | then (12 >= col) | |
73 | + | else false) | |
74 | + | then cell(cells, (row - 2), (col + 2)) | |
75 | + | else ("" + (if (if ((row >= 1)) | |
76 | + | then (13 >= col) | |
77 | + | else false) | |
78 | + | then cell(cells, (row - 1), (col + 1)) | |
79 | + | else (("" + cell(cells, row, col)) + (if (if ((13 >= row)) | |
80 | + | then (col >= 1) | |
81 | + | else false) | |
82 | + | then cell(cells, (row + 1), (col - 1)) | |
83 | + | else ("" + (if (if ((12 >= row)) | |
84 | + | then (col >= 2) | |
85 | + | else false) | |
86 | + | then cell(cells, (row + 2), (col - 2)) | |
87 | + | else ("" + (if (if ((11 >= row)) | |
88 | + | then (col >= 3) | |
89 | + | else false) | |
90 | + | then cell(cells, (row + 3), (col - 3)) | |
91 | + | else ("" + (if (if ((10 >= row)) | |
92 | + | then (col >= 4) | |
93 | + | else false) | |
94 | + | then cell(cells, (row + 4), (col - 4)) | |
95 | + | else "")))))))))))))) | |
96 | + | ||
97 | + | ||
98 | + | func getLDiag (cells,row,col) = if (if ((row >= 4)) | |
99 | + | then (col >= 4) | |
100 | + | else false) | |
101 | + | then cell(cells, (row - 4), (col - 4)) | |
102 | + | else ("" + (if (if ((row >= 3)) | |
103 | + | then (col >= 3) | |
104 | + | else false) | |
105 | + | then cell(cells, (row - 3), (col - 3)) | |
106 | + | else ("" + (if (if ((row >= 2)) | |
107 | + | then (col >= 2) | |
108 | + | else false) | |
109 | + | then cell(cells, (row - 2), (col - 2)) | |
110 | + | else ("" + (if (if ((row >= 1)) | |
111 | + | then (col >= 1) | |
112 | + | else false) | |
113 | + | then cell(cells, (row - 1), (col - 1)) | |
114 | + | else (("" + cell(cells, row, col)) + (if (if ((13 >= row)) | |
115 | + | then (13 >= col) | |
116 | + | else false) | |
117 | + | then cell(cells, (row + 1), (col + 1)) | |
118 | + | else ("" + (if (if ((12 >= row)) | |
119 | + | then (12 >= col) | |
120 | + | else false) | |
121 | + | then cell(cells, (row + 2), (col + 2)) | |
122 | + | else ("" + (if (if ((11 >= row)) | |
123 | + | then (11 >= col) | |
124 | + | else false) | |
125 | + | then cell(cells, (row + 3), (col + 3)) | |
126 | + | else ("" + (if (if ((10 >= row)) | |
127 | + | then (10 >= col) | |
128 | + | else false) | |
129 | + | then cell(cells, (row + 4), (col + 4)) | |
130 | + | else "")))))))))))))) | |
131 | + | ||
132 | + | ||
133 | + | func checkField (cells,c,row,col) = { | |
134 | + | let targetLines = ((((((getRow(cells, row, col) + "|") + getColumn(cells, row, col)) + "|") + getRDiag(cells, row, col)) + "|") + getLDiag(cells, row, col)) | |
135 | + | check(targetLines, c) | |
136 | + | } | |
137 | + | ||
138 | + | ||
139 | + | func checkFieldB (cells,row,col) = checkField(cells, "b", row, col) | |
140 | + | ||
141 | + | ||
142 | + | func checkFieldW (cells,row,col) = checkField(cells, "w", row, col) | |
143 | + | ||
144 | + | ||
49 | 145 | @Callable(i) | |
50 | - | func test (game, | |
146 | + | func test (game,row,col) = { | |
51 | 147 | let cells = extract(getString(this, (("game:" + toString(game)) + "_cells"))) | |
52 | - | throw(toString( | |
148 | + | throw(((toString(checkFieldB(cells, row, col)) + ", ") + toString(checkFieldW(cells, row, col)))) | |
53 | 149 | } | |
54 | 150 | ||
55 | 151 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func fiveChars (c) = ((((c + c) + c) + c) + c) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func cell (cells,row,col) = takeRight(take(cells, (((row * 15) + col) + 1)), 1) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func setCell (cells,row,col,val) = ((take(cells, ((row * 15) + col)) + val) + takeRight(cells, (size(cells) - (((row * 15) + col) + 1)))) | |
11 | - | ||
12 | - | ||
13 | - | func row (cells,row) = ((((((((((((((cell(cells, row, 0) + cell(cells, row, 1)) + cell(cells, row, 2)) + cell(cells, row, 3)) + cell(cells, row, 4)) + cell(cells, row, 5)) + cell(cells, row, 6)) + cell(cells, row, 7)) + cell(cells, row, 8)) + cell(cells, row, 9)) + cell(cells, row, 10)) + cell(cells, row, 11)) + cell(cells, row, 12)) + cell(cells, row, 13)) + cell(cells, row, 14)) | |
14 | - | ||
15 | - | ||
16 | - | func column (cells,col) = ((((((((((((((cell(cells, 0, col) + cell(cells, 1, col)) + cell(cells, 2, col)) + cell(cells, 3, col)) + cell(cells, 4, col)) + cell(cells, 5, col)) + cell(cells, 6, col)) + cell(cells, 7, col)) + cell(cells, 8, col)) + cell(cells, 9, col)) + cell(cells, 10, col)) + cell(cells, 11, col)) + cell(cells, 12, col)) + cell(cells, 13, col)) + cell(cells, 14, col)) | |
17 | - | ||
18 | - | ||
19 | - | func diagHelper (cells,d,dir,i) = if ((dir == "R")) | |
20 | - | then if (if ((d >= i)) | |
21 | - | then ((14 + i) >= d) | |
22 | - | else false) | |
23 | - | then cell(cells, i, (d - i)) | |
24 | - | else "" | |
25 | - | else if ((dir == "L")) | |
26 | - | then if (if ((d >= i)) | |
27 | - | then ((14 + i) >= d) | |
28 | - | else false) | |
29 | - | then cell(cells, (d - i), (14 - i)) | |
30 | - | else "" | |
31 | - | else throw("invalid dir in diagHelper function") | |
32 | - | ||
33 | - | ||
34 | - | func diag (cells,d,dir) = ((((((((((((((diagHelper(cells, d, dir, 14) + diagHelper(cells, d, dir, 13)) + diagHelper(cells, d, dir, 12)) + diagHelper(cells, d, dir, 11)) + diagHelper(cells, d, dir, 10)) + diagHelper(cells, d, dir, 9)) + diagHelper(cells, d, dir, 8)) + diagHelper(cells, d, dir, 7)) + diagHelper(cells, d, dir, 6)) + diagHelper(cells, d, dir, 5)) + diagHelper(cells, d, dir, 4)) + diagHelper(cells, d, dir, 3)) + diagHelper(cells, d, dir, 2)) + diagHelper(cells, d, dir, 1)) + diagHelper(cells, d, dir, 0)) | |
35 | 11 | ||
36 | 12 | ||
37 | 13 | func check (line,c) = if (if ((c != "b")) | |
38 | 14 | then (c != "w") | |
39 | 15 | else false) | |
40 | 16 | then throw("invalid color in check function") | |
41 | 17 | else match indexOf(line, fiveChars(c)) { | |
42 | 18 | case _: Int => | |
43 | 19 | true | |
44 | 20 | case _ => | |
45 | 21 | false | |
46 | 22 | } | |
47 | 23 | ||
48 | 24 | ||
25 | + | func getRow (cells,row,col) = if ((col >= 4)) | |
26 | + | then cell(cells, row, (col - 4)) | |
27 | + | else ("" + (if ((col >= 3)) | |
28 | + | then cell(cells, row, (col - 3)) | |
29 | + | else ("" + (if ((col >= 2)) | |
30 | + | then cell(cells, row, (col - 2)) | |
31 | + | else ("" + (if ((col >= 1)) | |
32 | + | then cell(cells, row, (col - 1)) | |
33 | + | else (("" + cell(cells, row, col)) + (if ((13 >= col)) | |
34 | + | then cell(cells, row, (col + 1)) | |
35 | + | else ("" + (if ((12 >= col)) | |
36 | + | then cell(cells, row, (col + 2)) | |
37 | + | else ("" + (if ((11 >= col)) | |
38 | + | then cell(cells, row, (col + 3)) | |
39 | + | else ("" + (if ((10 >= col)) | |
40 | + | then cell(cells, row, (col + 4)) | |
41 | + | else "")))))))))))))) | |
42 | + | ||
43 | + | ||
44 | + | func getColumn (cells,row,col) = if ((row >= 4)) | |
45 | + | then cell(cells, (row - 4), col) | |
46 | + | else ("" + (if ((row >= 3)) | |
47 | + | then cell(cells, (row - 3), col) | |
48 | + | else ("" + (if ((row >= 2)) | |
49 | + | then cell(cells, (row - 2), col) | |
50 | + | else ("" + (if ((row >= 1)) | |
51 | + | then cell(cells, (row - 1), col) | |
52 | + | else (("" + cell(cells, row, col)) + (if ((13 >= row)) | |
53 | + | then cell(cells, (row + 1), col) | |
54 | + | else ("" + (if ((12 >= row)) | |
55 | + | then cell(cells, (row + 2), col) | |
56 | + | else ("" + (if ((11 >= row)) | |
57 | + | then cell(cells, (row + 3), col) | |
58 | + | else ("" + (if ((10 >= row)) | |
59 | + | then cell(cells, (row + 4), col) | |
60 | + | else "")))))))))))))) | |
61 | + | ||
62 | + | ||
63 | + | func getRDiag (cells,row,col) = if (if ((row >= 4)) | |
64 | + | then (10 >= col) | |
65 | + | else false) | |
66 | + | then cell(cells, (row - 4), (col + 4)) | |
67 | + | else ("" + (if (if ((row >= 3)) | |
68 | + | then (11 >= col) | |
69 | + | else false) | |
70 | + | then cell(cells, (row - 3), (col + 3)) | |
71 | + | else ("" + (if (if ((row >= 2)) | |
72 | + | then (12 >= col) | |
73 | + | else false) | |
74 | + | then cell(cells, (row - 2), (col + 2)) | |
75 | + | else ("" + (if (if ((row >= 1)) | |
76 | + | then (13 >= col) | |
77 | + | else false) | |
78 | + | then cell(cells, (row - 1), (col + 1)) | |
79 | + | else (("" + cell(cells, row, col)) + (if (if ((13 >= row)) | |
80 | + | then (col >= 1) | |
81 | + | else false) | |
82 | + | then cell(cells, (row + 1), (col - 1)) | |
83 | + | else ("" + (if (if ((12 >= row)) | |
84 | + | then (col >= 2) | |
85 | + | else false) | |
86 | + | then cell(cells, (row + 2), (col - 2)) | |
87 | + | else ("" + (if (if ((11 >= row)) | |
88 | + | then (col >= 3) | |
89 | + | else false) | |
90 | + | then cell(cells, (row + 3), (col - 3)) | |
91 | + | else ("" + (if (if ((10 >= row)) | |
92 | + | then (col >= 4) | |
93 | + | else false) | |
94 | + | then cell(cells, (row + 4), (col - 4)) | |
95 | + | else "")))))))))))))) | |
96 | + | ||
97 | + | ||
98 | + | func getLDiag (cells,row,col) = if (if ((row >= 4)) | |
99 | + | then (col >= 4) | |
100 | + | else false) | |
101 | + | then cell(cells, (row - 4), (col - 4)) | |
102 | + | else ("" + (if (if ((row >= 3)) | |
103 | + | then (col >= 3) | |
104 | + | else false) | |
105 | + | then cell(cells, (row - 3), (col - 3)) | |
106 | + | else ("" + (if (if ((row >= 2)) | |
107 | + | then (col >= 2) | |
108 | + | else false) | |
109 | + | then cell(cells, (row - 2), (col - 2)) | |
110 | + | else ("" + (if (if ((row >= 1)) | |
111 | + | then (col >= 1) | |
112 | + | else false) | |
113 | + | then cell(cells, (row - 1), (col - 1)) | |
114 | + | else (("" + cell(cells, row, col)) + (if (if ((13 >= row)) | |
115 | + | then (13 >= col) | |
116 | + | else false) | |
117 | + | then cell(cells, (row + 1), (col + 1)) | |
118 | + | else ("" + (if (if ((12 >= row)) | |
119 | + | then (12 >= col) | |
120 | + | else false) | |
121 | + | then cell(cells, (row + 2), (col + 2)) | |
122 | + | else ("" + (if (if ((11 >= row)) | |
123 | + | then (11 >= col) | |
124 | + | else false) | |
125 | + | then cell(cells, (row + 3), (col + 3)) | |
126 | + | else ("" + (if (if ((10 >= row)) | |
127 | + | then (10 >= col) | |
128 | + | else false) | |
129 | + | then cell(cells, (row + 4), (col + 4)) | |
130 | + | else "")))))))))))))) | |
131 | + | ||
132 | + | ||
133 | + | func checkField (cells,c,row,col) = { | |
134 | + | let targetLines = ((((((getRow(cells, row, col) + "|") + getColumn(cells, row, col)) + "|") + getRDiag(cells, row, col)) + "|") + getLDiag(cells, row, col)) | |
135 | + | check(targetLines, c) | |
136 | + | } | |
137 | + | ||
138 | + | ||
139 | + | func checkFieldB (cells,row,col) = checkField(cells, "b", row, col) | |
140 | + | ||
141 | + | ||
142 | + | func checkFieldW (cells,row,col) = checkField(cells, "w", row, col) | |
143 | + | ||
144 | + | ||
49 | 145 | @Callable(i) | |
50 | - | func test (game, | |
146 | + | func test (game,row,col) = { | |
51 | 147 | let cells = extract(getString(this, (("game:" + toString(game)) + "_cells"))) | |
52 | - | throw(toString( | |
148 | + | throw(((toString(checkFieldB(cells, row, col)) + ", ") + toString(checkFieldW(cells, row, col)))) | |
53 | 149 | } | |
54 | 150 | ||
55 | 151 | ||
56 | 152 | ||
57 | 153 | @Callable(i) | |
58 | 154 | func testSetCell (game,row,col,val) = { | |
59 | 155 | let cells = extract(getString(this, (("game:" + toString(game)) + "_cells"))) | |
60 | 156 | let newCells = setCell(cells, row, col, val) | |
61 | 157 | WriteSet([DataEntry((("game:" + toString(game)) + "_cells"), newCells)]) | |
62 | 158 | } | |
63 | 159 | ||
64 | 160 | ||
65 | 161 | @Verifier(tx) | |
66 | 162 | func verify () = true | |
67 | 163 |
github/deemru/w8io/026f985 30.92 ms ◑