tx · 83MTpnBtpe2b2riaztqLGWQUA7HTtdsefpSdDEUvsYtc 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5: -0.05000000 Waves 2024.09.09 17:45 [3276214] smart account 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5 > SELF 0.00000000 Waves
{ "type": 13, "id": "83MTpnBtpe2b2riaztqLGWQUA7HTtdsefpSdDEUvsYtc", "fee": 5000000, "feeAssetId": null, "timestamp": 1725893126889, "version": 2, "chainId": 84, "sender": "3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5", "senderPublicKey": "DhKSnv34wE65np8uDd8E6ygEbNsn6fHx9p7q4hJTcgRw", "proofs": [ "2rPVxRp49VVSqwqQ4L4VbVq6gkMu6qCbWU8YGxB4P4KuPk1NCpmN2CP8ofxntdrFDDnU2qYGUExuK9edGEr4Q4kx" ], "script": "base64:AAIFAAAAAAAAAA0IAhIDCgEIEgQKAggIAAAACQAAAAAMQkFJX0NPTlRSQUNUAgAAACMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAAGUExBWUVSAgAAAAExAAAAAAJBSQIAAAABMgAAAAAOV0lOTklOR19BTU9VTlQEAAAAByRtYXRjaDAJAAQfAAAAAQIAAAAOd2lubmluZ19hbW91bnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABaQUAAAAHJG1hdGNoMAUAAAABaQAAAAAAHc1lAAEAAAAGY2hhckF0AAAAAgAAAANzdHIAAAABaQkAAZEAAAACCQAEtQAAAAIFAAAAA3N0cgIAAAAABQAAAAFpAQAAABJjaGVja0lmTW92ZUlzVmFsaWQAAAACAAAABmdhbWVJZAAAAAVib2FyZAQAAAAMY3VycmVudEJvYXJkBAAAAAckbWF0Y2gwCQAEIgAAAAEJAAEsAAAAAgIAAAANY3VycmVud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nJlbnRCb2FyZF8FAAAABmdhbWVJZAUAAAAFYm9hcmQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAAppbml0aWF0b3JfBQAAAAZnYW1lSWQJAAQlAAAAAQUAAAAGc2VuZGVyCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAHd2lubmVyXwUAAAAGZ2FtZUlkAgAAAARub25lCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAMbmV4dF9wbGF5ZXJfBQAAAAZnYW1lSWQFAAAAAkFJBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmWEZd8", "height": 3276214, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9HXUW3e7qW9yfEXJrruUCqGnpndLRLxgqDEmocWPGwTf Next: GyKh7FGVCAL4xcc72iDjBMLCv6WMi88iLnkMvbLfHEkS Diff:
Old | New | Differences | |
---|---|---|---|
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] |
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 = 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 | 223 | func callback (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/026f985 39.37 ms ◑