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