tx · 67HYTywb5xb6UbqiL2hAjR4pbjX8uMjcmhsXVJYqcuLj 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5: -0.05000000 Waves 2024.07.28 12:57 [3213781] smart account 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5 > SELF 0.00000000 Waves
{ "type": 13, "id": "67HYTywb5xb6UbqiL2hAjR4pbjX8uMjcmhsXVJYqcuLj", "fee": 5000000, "feeAssetId": null, "timestamp": 1722160658171, "version": 2, "chainId": 84, "sender": "3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5", "senderPublicKey": "DhKSnv34wE65np8uDd8E6ygEbNsn6fHx9p7q4hJTcgRw", "proofs": [ "54m9cSFuCvTrTsVTrH3ckF9ZRcTTaBW3KL5KpdLNfALEQqt9Bv1FxdkwC656pzShtvLxtMuY3kCF3wYvkdtUubRX" ], "script": "base64:AAIFAAAAAAAAAA0IAhIDCgEIEgQKAggIAAAACQAAAAAMQkFJX0NPTlRSQUNUAgAAACMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAAGUExBWUVSAgAAAAExAAAAAAJBSQIAAAABMgAAAAAOV0lOTklOR19BTU9VTlQAAAAAAAX14QABAAAABmNoYXJBdAAAAAIAAAADc3RyAAAAAWkJAAGRAAAAAgkABLUAAAACBQAAAANzdHICAAAAAAUAAAABaQEAAAASY2hlY2tJZk1vdmVJc1ZhbGlkAAAAAgAAAAZnYW1lSWQAAAAFYm9hcmQEAAAADGN1cnJlbnRCb2FyZAQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAICAAAADWN1cnJlbnRCb2FyZF8FAAAABmdhbWVJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAgAAAAkwMDAwMDAw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MAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAA1jdXJyZW50Qm9hcmRfBQAAAAZnYW1lSWQFAAAABWJvYXJkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAKaW5pdGlhdG9yXwUAAAAGZ2FtZUlkCQAEJQAAAAEFAAAABnNlbmRlcgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAADG5leHRfcGxheWVyXwUAAAAGZ2FtZUlkBQAAAAJBSQUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5WFuRTg==", "height": 3213781, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GcQaDNHmT1syezTKm3oevMiBGiNkXnrPsF41So8rqWyd Next: BcUeLAMoa43odQ5xV8nNd7JpLfSjopbhQR4tkBJsTEKZ Diff:
Old | New | Differences | |
---|---|---|---|
123 | 123 | ||
124 | 124 | ||
125 | 125 | func checkIfPlayerHasWon (gameId,board,player) = { | |
126 | - | let currentBoard = if ((player == AI)) | |
127 | - | then board | |
128 | - | else match getString(("currentBoard_" + gameId)) { | |
129 | - | case s: String => | |
130 | - | s | |
131 | - | case _ => | |
132 | - | "000000000" | |
133 | - | } | |
126 | + | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
127 | + | case s: String => | |
128 | + | s | |
129 | + | case _ => | |
130 | + | "000000000" | |
131 | + | } | |
134 | 132 | let winningCombinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]] | |
135 | - | let topRow = if (if ((charAt( | |
136 | - | then (charAt( | |
133 | + | let topRow = if (if ((charAt(board, winningCombinations[0][0]) == player)) | |
134 | + | then (charAt(board, winningCombinations[0][1]) == player) | |
137 | 135 | else false) | |
138 | - | then (charAt( | |
136 | + | then (charAt(board, winningCombinations[0][2]) == player) | |
139 | 137 | else false | |
140 | - | let middleRow = if (if ((charAt( | |
141 | - | then (charAt( | |
138 | + | let middleRow = if (if ((charAt(board, winningCombinations[1][0]) == player)) | |
139 | + | then (charAt(board, winningCombinations[1][1]) == player) | |
142 | 140 | else false) | |
143 | - | then (charAt( | |
141 | + | then (charAt(board, winningCombinations[1][2]) == player) | |
144 | 142 | else false | |
145 | - | let bottomRow = if (if ((charAt( | |
146 | - | then (charAt( | |
143 | + | let bottomRow = if (if ((charAt(board, winningCombinations[2][0]) == player)) | |
144 | + | then (charAt(board, winningCombinations[2][1]) == player) | |
147 | 145 | else false) | |
148 | - | then (charAt( | |
146 | + | then (charAt(board, winningCombinations[2][2]) == player) | |
149 | 147 | else false | |
150 | - | let leftColumn = if (if ((charAt( | |
151 | - | then (charAt( | |
148 | + | let leftColumn = if (if ((charAt(board, winningCombinations[3][0]) == player)) | |
149 | + | then (charAt(board, winningCombinations[3][1]) == player) | |
152 | 150 | else false) | |
153 | - | then (charAt( | |
151 | + | then (charAt(board, winningCombinations[3][2]) == player) | |
154 | 152 | else false | |
155 | - | let middleColumn = if (if ((charAt( | |
156 | - | then (charAt( | |
153 | + | let middleColumn = if (if ((charAt(board, winningCombinations[4][0]) == player)) | |
154 | + | then (charAt(board, winningCombinations[4][1]) == player) | |
157 | 155 | else false) | |
158 | - | then (charAt( | |
156 | + | then (charAt(board, winningCombinations[4][2]) == player) | |
159 | 157 | else false | |
160 | - | let rightColumn = if (if ((charAt( | |
161 | - | then (charAt( | |
158 | + | let rightColumn = if (if ((charAt(board, winningCombinations[5][0]) == player)) | |
159 | + | then (charAt(board, winningCombinations[5][1]) == player) | |
162 | 160 | else false) | |
163 | - | then (charAt( | |
161 | + | then (charAt(board, winningCombinations[5][2]) == player) | |
164 | 162 | else false | |
165 | - | let diagonalOne = if (if ((charAt( | |
166 | - | then (charAt( | |
163 | + | let diagonalOne = if (if ((charAt(board, winningCombinations[6][0]) == player)) | |
164 | + | then (charAt(board, winningCombinations[6][1]) == player) | |
167 | 165 | else false) | |
168 | - | then (charAt( | |
166 | + | then (charAt(board, winningCombinations[6][2]) == player) | |
169 | 167 | else false | |
170 | - | let diagonalTwo = if (if ((charAt( | |
171 | - | then (charAt( | |
168 | + | let diagonalTwo = if (if ((charAt(board, winningCombinations[7][0]) == player)) | |
169 | + | then (charAt(board, winningCombinations[7][1]) == player) | |
172 | 170 | else false) | |
173 | - | then (charAt( | |
171 | + | then (charAt(board, winningCombinations[7][2]) == player) | |
174 | 172 | else false | |
175 | 173 | if (if (if (if (if (if (if (topRow) | |
176 | 174 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let BAI_CONTRACT = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV" | |
5 | 5 | ||
6 | 6 | let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1' | |
7 | 7 | ||
8 | 8 | let PLAYER = "1" | |
9 | 9 | ||
10 | 10 | let AI = "2" | |
11 | 11 | ||
12 | 12 | let WINNING_AMOUNT = 100000000 | |
13 | 13 | ||
14 | 14 | func charAt (str,i) = split(str, "")[i] | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func checkIfMoveIsValid (gameId,board) = { | |
18 | 18 | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
19 | 19 | case s: String => | |
20 | 20 | s | |
21 | 21 | case _ => | |
22 | 22 | "000000000" | |
23 | 23 | } | |
24 | 24 | let firstSelected = if ((charAt(board, 0) != charAt(currentBoard, 0))) | |
25 | 25 | then 1 | |
26 | 26 | else 0 | |
27 | 27 | let secondSelected = if ((charAt(board, 1) != charAt(currentBoard, 1))) | |
28 | 28 | then 1 | |
29 | 29 | else 0 | |
30 | 30 | let thirdSelected = if ((charAt(board, 2) != charAt(currentBoard, 2))) | |
31 | 31 | then 1 | |
32 | 32 | else 0 | |
33 | 33 | let fourthSelected = if ((charAt(board, 3) != charAt(currentBoard, 3))) | |
34 | 34 | then 1 | |
35 | 35 | else 0 | |
36 | 36 | let fifthSelected = if ((charAt(board, 4) != charAt(currentBoard, 4))) | |
37 | 37 | then 1 | |
38 | 38 | else 0 | |
39 | 39 | let sixthSelected = if ((charAt(board, 5) != charAt(currentBoard, 5))) | |
40 | 40 | then 1 | |
41 | 41 | else 0 | |
42 | 42 | let seventhSelected = if ((charAt(board, 6) != charAt(currentBoard, 6))) | |
43 | 43 | then 1 | |
44 | 44 | else 0 | |
45 | 45 | let eighthSelected = if ((charAt(board, 7) != charAt(currentBoard, 7))) | |
46 | 46 | then 1 | |
47 | 47 | else 0 | |
48 | 48 | let ninthSelected = if ((charAt(board, 8) != charAt(currentBoard, 8))) | |
49 | 49 | then 1 | |
50 | 50 | else 0 | |
51 | 51 | let firstPositionCorrect = if (if ((charAt(board, 0) == charAt(currentBoard, 0))) | |
52 | 52 | then true | |
53 | 53 | else (charAt(currentBoard, 0) == "0")) | |
54 | 54 | then true | |
55 | 55 | else false | |
56 | 56 | let secondPositionCorrect = if (if ((charAt(board, 1) == charAt(currentBoard, 1))) | |
57 | 57 | then true | |
58 | 58 | else (charAt(currentBoard, 1) == "0")) | |
59 | 59 | then true | |
60 | 60 | else false | |
61 | 61 | let thirdPositionCorrect = if (if ((charAt(board, 2) == charAt(currentBoard, 2))) | |
62 | 62 | then true | |
63 | 63 | else (charAt(currentBoard, 2) == "0")) | |
64 | 64 | then true | |
65 | 65 | else false | |
66 | 66 | let fourthPositionCorrect = if (if ((charAt(board, 3) == charAt(currentBoard, 3))) | |
67 | 67 | then true | |
68 | 68 | else (charAt(currentBoard, 3) == "0")) | |
69 | 69 | then true | |
70 | 70 | else false | |
71 | 71 | let fifthPositionCorrect = if (if ((charAt(board, 4) == charAt(currentBoard, 4))) | |
72 | 72 | then true | |
73 | 73 | else (charAt(currentBoard, 4) == "0")) | |
74 | 74 | then true | |
75 | 75 | else false | |
76 | 76 | let sixthPositionCorrect = if (if ((charAt(board, 5) == charAt(currentBoard, 5))) | |
77 | 77 | then true | |
78 | 78 | else (charAt(currentBoard, 5) == "0")) | |
79 | 79 | then true | |
80 | 80 | else false | |
81 | 81 | let seventhPositionCorrect = if (if ((charAt(board, 6) == charAt(currentBoard, 6))) | |
82 | 82 | then true | |
83 | 83 | else (charAt(currentBoard, 6) == "0")) | |
84 | 84 | then true | |
85 | 85 | else false | |
86 | 86 | let eighthPositionCorrect = if (if ((charAt(board, 7) == charAt(currentBoard, 7))) | |
87 | 87 | then true | |
88 | 88 | else (charAt(currentBoard, 7) == "0")) | |
89 | 89 | then true | |
90 | 90 | else false | |
91 | 91 | let ninthPositionCorrect = if (if ((charAt(board, 8) == charAt(currentBoard, 8))) | |
92 | 92 | then true | |
93 | 93 | else (charAt(currentBoard, 8) == "0")) | |
94 | 94 | then true | |
95 | 95 | else false | |
96 | 96 | let noOldPositionOverwritten = if (if (if (if (if (if (if (if (firstPositionCorrect) | |
97 | 97 | then secondPositionCorrect | |
98 | 98 | else false) | |
99 | 99 | then thirdPositionCorrect | |
100 | 100 | else false) | |
101 | 101 | then fourthPositionCorrect | |
102 | 102 | else false) | |
103 | 103 | then fifthPositionCorrect | |
104 | 104 | else false) | |
105 | 105 | then sixthPositionCorrect | |
106 | 106 | else false) | |
107 | 107 | then seventhPositionCorrect | |
108 | 108 | else false) | |
109 | 109 | then eighthPositionCorrect | |
110 | 110 | else false) | |
111 | 111 | then ninthPositionCorrect | |
112 | 112 | else false | |
113 | 113 | let countMoves = ((((((((firstSelected + secondSelected) + thirdSelected) + fourthSelected) + fifthSelected) + sixthSelected) + seventhSelected) + eighthSelected) + ninthSelected) | |
114 | 114 | let onlyOneMove = (1 >= countMoves) | |
115 | 115 | if ((countMoves > 1)) | |
116 | 116 | then throw("More than move made!") | |
117 | 117 | else if (!(noOldPositionOverwritten)) | |
118 | 118 | then throw("Former position overwritten!") | |
119 | 119 | else if (noOldPositionOverwritten) | |
120 | 120 | then onlyOneMove | |
121 | 121 | else false | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func checkIfPlayerHasWon (gameId,board,player) = { | |
126 | - | let currentBoard = if ((player == AI)) | |
127 | - | then board | |
128 | - | else match getString(("currentBoard_" + gameId)) { | |
129 | - | case s: String => | |
130 | - | s | |
131 | - | case _ => | |
132 | - | "000000000" | |
133 | - | } | |
126 | + | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
127 | + | case s: String => | |
128 | + | s | |
129 | + | case _ => | |
130 | + | "000000000" | |
131 | + | } | |
134 | 132 | let winningCombinations = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]] | |
135 | - | let topRow = if (if ((charAt( | |
136 | - | then (charAt( | |
133 | + | let topRow = if (if ((charAt(board, winningCombinations[0][0]) == player)) | |
134 | + | then (charAt(board, winningCombinations[0][1]) == player) | |
137 | 135 | else false) | |
138 | - | then (charAt( | |
136 | + | then (charAt(board, winningCombinations[0][2]) == player) | |
139 | 137 | else false | |
140 | - | let middleRow = if (if ((charAt( | |
141 | - | then (charAt( | |
138 | + | let middleRow = if (if ((charAt(board, winningCombinations[1][0]) == player)) | |
139 | + | then (charAt(board, winningCombinations[1][1]) == player) | |
142 | 140 | else false) | |
143 | - | then (charAt( | |
141 | + | then (charAt(board, winningCombinations[1][2]) == player) | |
144 | 142 | else false | |
145 | - | let bottomRow = if (if ((charAt( | |
146 | - | then (charAt( | |
143 | + | let bottomRow = if (if ((charAt(board, winningCombinations[2][0]) == player)) | |
144 | + | then (charAt(board, winningCombinations[2][1]) == player) | |
147 | 145 | else false) | |
148 | - | then (charAt( | |
146 | + | then (charAt(board, winningCombinations[2][2]) == player) | |
149 | 147 | else false | |
150 | - | let leftColumn = if (if ((charAt( | |
151 | - | then (charAt( | |
148 | + | let leftColumn = if (if ((charAt(board, winningCombinations[3][0]) == player)) | |
149 | + | then (charAt(board, winningCombinations[3][1]) == player) | |
152 | 150 | else false) | |
153 | - | then (charAt( | |
151 | + | then (charAt(board, winningCombinations[3][2]) == player) | |
154 | 152 | else false | |
155 | - | let middleColumn = if (if ((charAt( | |
156 | - | then (charAt( | |
153 | + | let middleColumn = if (if ((charAt(board, winningCombinations[4][0]) == player)) | |
154 | + | then (charAt(board, winningCombinations[4][1]) == player) | |
157 | 155 | else false) | |
158 | - | then (charAt( | |
156 | + | then (charAt(board, winningCombinations[4][2]) == player) | |
159 | 157 | else false | |
160 | - | let rightColumn = if (if ((charAt( | |
161 | - | then (charAt( | |
158 | + | let rightColumn = if (if ((charAt(board, winningCombinations[5][0]) == player)) | |
159 | + | then (charAt(board, winningCombinations[5][1]) == player) | |
162 | 160 | else false) | |
163 | - | then (charAt( | |
161 | + | then (charAt(board, winningCombinations[5][2]) == player) | |
164 | 162 | else false | |
165 | - | let diagonalOne = if (if ((charAt( | |
166 | - | then (charAt( | |
163 | + | let diagonalOne = if (if ((charAt(board, winningCombinations[6][0]) == player)) | |
164 | + | then (charAt(board, winningCombinations[6][1]) == player) | |
167 | 165 | else false) | |
168 | - | then (charAt( | |
166 | + | then (charAt(board, winningCombinations[6][2]) == player) | |
169 | 167 | else false | |
170 | - | let diagonalTwo = if (if ((charAt( | |
171 | - | then (charAt( | |
168 | + | let diagonalTwo = if (if ((charAt(board, winningCombinations[7][0]) == player)) | |
169 | + | then (charAt(board, winningCombinations[7][1]) == player) | |
172 | 170 | else false) | |
173 | - | then (charAt( | |
171 | + | then (charAt(board, winningCombinations[7][2]) == player) | |
174 | 172 | else false | |
175 | 173 | if (if (if (if (if (if (if (topRow) | |
176 | 174 | then true | |
177 | 175 | else middleRow) | |
178 | 176 | then true | |
179 | 177 | else bottomRow) | |
180 | 178 | then true | |
181 | 179 | else leftColumn) | |
182 | 180 | then true | |
183 | 181 | else middleRow) | |
184 | 182 | then true | |
185 | 183 | else rightColumn) | |
186 | 184 | then true | |
187 | 185 | else diagonalOne) | |
188 | 186 | then true | |
189 | 187 | else diagonalTwo | |
190 | 188 | } | |
191 | 189 | ||
192 | 190 | ||
193 | 191 | func getPossibleMovesCount (board) = { | |
194 | 192 | let firstMovePossible = if ((charAt(board, 0) == "0")) | |
195 | 193 | then 1 | |
196 | 194 | else 0 | |
197 | 195 | let secondMovePossible = if ((charAt(board, 1) == "0")) | |
198 | 196 | then 1 | |
199 | 197 | else 0 | |
200 | 198 | let thirdMovePossible = if ((charAt(board, 2) == "0")) | |
201 | 199 | then 1 | |
202 | 200 | else 0 | |
203 | 201 | let fourthMovePossible = if ((charAt(board, 3) == "0")) | |
204 | 202 | then 1 | |
205 | 203 | else 0 | |
206 | 204 | let fifthMovePossible = if ((charAt(board, 4) == "0")) | |
207 | 205 | then 1 | |
208 | 206 | else 0 | |
209 | 207 | let sixthMovePossible = if ((charAt(board, 5) == "0")) | |
210 | 208 | then 1 | |
211 | 209 | else 0 | |
212 | 210 | let seventhMovePossible = if ((charAt(board, 6) == "0")) | |
213 | 211 | then 1 | |
214 | 212 | else 0 | |
215 | 213 | let eigthMovePossible = if ((charAt(board, 7) == "0")) | |
216 | 214 | then 1 | |
217 | 215 | else 0 | |
218 | 216 | let ninthMovePossible = if ((charAt(board, 8) == "0")) | |
219 | 217 | then 1 | |
220 | 218 | else 0 | |
221 | 219 | ((((((((firstMovePossible + secondMovePossible) + thirdMovePossible) + fourthMovePossible) + fifthMovePossible) + sixthMovePossible) + seventhMovePossible) + eigthMovePossible) + ninthMovePossible) | |
222 | 220 | } | |
223 | 221 | ||
224 | 222 | ||
225 | 223 | @Callable(i) | |
226 | 224 | func callback (gameIdAndBoard) = { | |
227 | 225 | let parts = split(gameIdAndBoard, "_") | |
228 | 226 | let gameId = parts[0] | |
229 | 227 | let board = parts[1] | |
230 | 228 | let nextPlayer = match getString(("next_player_" + gameId)) { | |
231 | 229 | case s: String => | |
232 | 230 | s | |
233 | 231 | case _ => | |
234 | 232 | "" | |
235 | 233 | } | |
236 | 234 | let moveOfAIIsValid = checkIfMoveIsValid(gameId, board) | |
237 | 235 | if (!(moveOfAIIsValid)) | |
238 | 236 | then throw("Illegal move!") | |
239 | 237 | else if ((nextPlayer != AI)) | |
240 | 238 | then throw("Player has to move first!") | |
241 | 239 | else { | |
242 | 240 | let aiHasWon = checkIfPlayerHasWon(gameId, board, AI) | |
243 | 241 | if (aiHasWon) | |
244 | 242 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")] | |
245 | 243 | else [StringEntry(("currentBoard_" + gameId), board), StringEntry(("next_player_" + gameId), PLAYER)] | |
246 | 244 | } | |
247 | 245 | } | |
248 | 246 | ||
249 | 247 | ||
250 | 248 | ||
251 | 249 | @Callable(i) | |
252 | 250 | func playTTT (game,board) = { | |
253 | 251 | let numberOfPayments = size(i.payments) | |
254 | 252 | if ((numberOfPayments != 1)) | |
255 | 253 | then throw("Payment necessary!") | |
256 | 254 | else { | |
257 | 255 | let payment = i.payments[0] | |
258 | 256 | let fee = payment.amount | |
259 | 257 | let feeAssetId = payment.assetId | |
260 | 258 | let minFee = match getInteger(Address(fromBase58String(BAI_CONTRACT)), "price_tictactoe") { | |
261 | 259 | case n: Int => | |
262 | 260 | n | |
263 | 261 | case _ => | |
264 | 262 | 0 | |
265 | 263 | } | |
266 | 264 | if (if ((feeAssetId != BAI_ASSET_ID)) | |
267 | 265 | then true | |
268 | 266 | else (minFee > fee)) | |
269 | 267 | then throw("Payment of the minimal BAI amount necessary!") | |
270 | 268 | else { | |
271 | 269 | let sender = i.caller | |
272 | 270 | let gameId = if ((size(game) == 0)) | |
273 | 271 | then toBase58String(i.transactionId) | |
274 | 272 | else game | |
275 | 273 | let nextPlayer = match getString(("next_player_" + gameId)) { | |
276 | 274 | case s: String => | |
277 | 275 | s | |
278 | 276 | case _ => | |
279 | 277 | PLAYER | |
280 | 278 | } | |
281 | 279 | if ((nextPlayer != PLAYER)) | |
282 | 280 | then throw("AI hast to move first!") | |
283 | 281 | else { | |
284 | 282 | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
285 | 283 | case s: String => | |
286 | 284 | s | |
287 | 285 | case _ => | |
288 | 286 | board | |
289 | 287 | } | |
290 | 288 | let initiator = match getString(("initiator_" + gameId)) { | |
291 | 289 | case s: String => | |
292 | 290 | s | |
293 | 291 | case _ => | |
294 | 292 | toString(sender) | |
295 | 293 | } | |
296 | 294 | if ((toString(sender) != initiator)) | |
297 | 295 | then throw("Only initiator is allowed to make moves!") | |
298 | 296 | else { | |
299 | 297 | let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board) | |
300 | 298 | if (!(moveOfPlayerIsValid)) | |
301 | 299 | then throw("Illegal move!") | |
302 | 300 | else { | |
303 | 301 | let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER) | |
304 | 302 | let numberOfPossibleMoves = getPossibleMovesCount(board) | |
305 | 303 | if (playerHasWon) | |
306 | 304 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)] | |
307 | 305 | else if ((numberOfPossibleMoves == 0)) | |
308 | 306 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "draw")] | |
309 | 307 | else { | |
310 | 308 | let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
311 | 309 | if ((nextMove == nextMove)) | |
312 | 310 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender)), StringEntry(("next_player_" + gameId), AI)] | |
313 | 311 | else throw("Strict value is not equal to itself.") | |
314 | 312 | } | |
315 | 313 | } | |
316 | 314 | } | |
317 | 315 | } | |
318 | 316 | } | |
319 | 317 | } | |
320 | 318 | } | |
321 | 319 | ||
322 | 320 | ||
323 | 321 | @Verifier(tx) | |
324 | 322 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
325 | 323 |
github/deemru/w8io/026f985 45.67 ms ◑