tx · GcQaDNHmT1syezTKm3oevMiBGiNkXnrPsF41So8rqWyd 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5: -0.05000000 Waves 2024.07.28 12:54 [3213778] smart account 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5 > SELF 0.00000000 Waves
{ "type": 13, "id": "GcQaDNHmT1syezTKm3oevMiBGiNkXnrPsF41So8rqWyd", "fee": 5000000, "feeAssetId": null, "timestamp": 1722160504406, "version": 2, "chainId": 84, "sender": "3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5", "senderPublicKey": "DhKSnv34wE65np8uDd8E6ygEbNsn6fHx9p7q4hJTcgRw", "proofs": [ "2gEtPjQuaHaQhgvugBcWAHk37ZBX43CaEvuxuqjAbe2MXcaRLMMk7u24nY1HTMZCwJ6fMggcepcF7V1SW9NGjk2g" ], "script": "base64:AAIFAAAAAAAAAA0IAhIDCgEIEgQKAggIAAAACQAAAAAMQkFJX0NPTlRSQUNUAgAAACMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAAGUExBWUVSAgAAAAExAAAAAAJBSQIAAAABMgAAAAAOV0lOTklOR19BTU9VTlQAAAAAAAX14QABAAAABmNoYXJBdAAAAAIAAAADc3RyAAAAAWkJAAGRAAAAAgkABLUAAAACBQAAAANzdHICAAAAAAUAAAABaQEAAAASY2hlY2tJZk1vdmVJc1ZhbGlkAAAAAgAAAAZnYW1lSWQAAAAFYm9hcmQEAAAADGN1cnJlbnRCb2FyZAQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAICAAAADWN1cnJlbnRCb2FyZF8FAAAABmdhbWVJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAgAAAAkwMDAwMDAwMDAEAAA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AAEsAAAAAgkAASwAAAACBQAAAAZnYW1lSWQCAAAAAV8FAAAABWJvYXJkCQAETAAAAAICAAAACXRpY3RhY3RvZQkABEwAAAACAgAAAAhjYWxsYmFjawUAAAADbmlsCQAETAAAAAIJAQAAAA9BdHRhY2hlZFBheW1lbnQAAAACBQAAAAxCQUlfQVNTRVRfSUQAAAAAAACYloAFAAAAA25pbAMJAAAAAAAAAgUAAAAIbmV4dE1vdmUFAAAACG5leHRNb3ZlCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAANY3VycmVudEJvYXJkXwUAAAAGZ2FtZUlkBQAAAAVib2FyZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAACmluaXRpYXRvcl8FAAAABmdhbWVJZAkABCUAAAABBQAAAAZzZW5kZXIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAAxuZXh0X3BsYXllcl8FAAAABmdhbWVJZAUAAAACQUkFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleZVtN3o=", "height": 3213778, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9UJfb1FGi8q23ZuKnmBA2AjutZKFwjbYqEngQTy5djbu Next: 67HYTywb5xb6UbqiL2hAjR4pbjX8uMjcmhsXVJYqcuLj Diff:
Old | New | Differences | |
---|---|---|---|
123 | 123 | ||
124 | 124 | ||
125 | 125 | func checkIfPlayerHasWon (gameId,board,player) = { | |
126 | - | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
127 | - | case s: String => | |
128 | - | s | |
129 | - | case _ => | |
130 | - | "000000000" | |
131 | - | } | |
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 | + | } | |
132 | 134 | 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]] | |
133 | 135 | let topRow = if (if ((charAt(currentBoard, winningCombinations[0][0]) == player)) | |
134 | 136 | then (charAt(currentBoard, winningCombinations[0][1]) == player) |
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 = match getString(("currentBoard_" + gameId)) { | |
127 | - | case s: String => | |
128 | - | s | |
129 | - | case _ => | |
130 | - | "000000000" | |
131 | - | } | |
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 | + | } | |
132 | 134 | 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]] | |
133 | 135 | let topRow = if (if ((charAt(currentBoard, winningCombinations[0][0]) == player)) | |
134 | 136 | then (charAt(currentBoard, winningCombinations[0][1]) == player) | |
135 | 137 | else false) | |
136 | 138 | then (charAt(currentBoard, winningCombinations[0][2]) == player) | |
137 | 139 | else false | |
138 | 140 | let middleRow = if (if ((charAt(currentBoard, winningCombinations[1][0]) == player)) | |
139 | 141 | then (charAt(currentBoard, winningCombinations[1][1]) == player) | |
140 | 142 | else false) | |
141 | 143 | then (charAt(currentBoard, winningCombinations[1][2]) == player) | |
142 | 144 | else false | |
143 | 145 | let bottomRow = if (if ((charAt(currentBoard, winningCombinations[2][0]) == player)) | |
144 | 146 | then (charAt(currentBoard, winningCombinations[2][1]) == player) | |
145 | 147 | else false) | |
146 | 148 | then (charAt(currentBoard, winningCombinations[2][2]) == player) | |
147 | 149 | else false | |
148 | 150 | let leftColumn = if (if ((charAt(currentBoard, winningCombinations[3][0]) == player)) | |
149 | 151 | then (charAt(currentBoard, winningCombinations[3][1]) == player) | |
150 | 152 | else false) | |
151 | 153 | then (charAt(currentBoard, winningCombinations[3][2]) == player) | |
152 | 154 | else false | |
153 | 155 | let middleColumn = if (if ((charAt(currentBoard, winningCombinations[4][0]) == player)) | |
154 | 156 | then (charAt(currentBoard, winningCombinations[4][1]) == player) | |
155 | 157 | else false) | |
156 | 158 | then (charAt(currentBoard, winningCombinations[4][2]) == player) | |
157 | 159 | else false | |
158 | 160 | let rightColumn = if (if ((charAt(currentBoard, winningCombinations[5][0]) == player)) | |
159 | 161 | then (charAt(currentBoard, winningCombinations[5][1]) == player) | |
160 | 162 | else false) | |
161 | 163 | then (charAt(currentBoard, winningCombinations[5][2]) == player) | |
162 | 164 | else false | |
163 | 165 | let diagonalOne = if (if ((charAt(currentBoard, winningCombinations[6][0]) == player)) | |
164 | 166 | then (charAt(currentBoard, winningCombinations[6][1]) == player) | |
165 | 167 | else false) | |
166 | 168 | then (charAt(currentBoard, winningCombinations[6][2]) == player) | |
167 | 169 | else false | |
168 | 170 | let diagonalTwo = if (if ((charAt(currentBoard, winningCombinations[7][0]) == player)) | |
169 | 171 | then (charAt(currentBoard, winningCombinations[7][1]) == player) | |
170 | 172 | else false) | |
171 | 173 | then (charAt(currentBoard, winningCombinations[7][2]) == player) | |
172 | 174 | else false | |
173 | 175 | if (if (if (if (if (if (if (topRow) | |
174 | 176 | then true | |
175 | 177 | else middleRow) | |
176 | 178 | then true | |
177 | 179 | else bottomRow) | |
178 | 180 | then true | |
179 | 181 | else leftColumn) | |
180 | 182 | then true | |
181 | 183 | else middleRow) | |
182 | 184 | then true | |
183 | 185 | else rightColumn) | |
184 | 186 | then true | |
185 | 187 | else diagonalOne) | |
186 | 188 | then true | |
187 | 189 | else diagonalTwo | |
188 | 190 | } | |
189 | 191 | ||
190 | 192 | ||
191 | 193 | func getPossibleMovesCount (board) = { | |
192 | 194 | let firstMovePossible = if ((charAt(board, 0) == "0")) | |
193 | 195 | then 1 | |
194 | 196 | else 0 | |
195 | 197 | let secondMovePossible = if ((charAt(board, 1) == "0")) | |
196 | 198 | then 1 | |
197 | 199 | else 0 | |
198 | 200 | let thirdMovePossible = if ((charAt(board, 2) == "0")) | |
199 | 201 | then 1 | |
200 | 202 | else 0 | |
201 | 203 | let fourthMovePossible = if ((charAt(board, 3) == "0")) | |
202 | 204 | then 1 | |
203 | 205 | else 0 | |
204 | 206 | let fifthMovePossible = if ((charAt(board, 4) == "0")) | |
205 | 207 | then 1 | |
206 | 208 | else 0 | |
207 | 209 | let sixthMovePossible = if ((charAt(board, 5) == "0")) | |
208 | 210 | then 1 | |
209 | 211 | else 0 | |
210 | 212 | let seventhMovePossible = if ((charAt(board, 6) == "0")) | |
211 | 213 | then 1 | |
212 | 214 | else 0 | |
213 | 215 | let eigthMovePossible = if ((charAt(board, 7) == "0")) | |
214 | 216 | then 1 | |
215 | 217 | else 0 | |
216 | 218 | let ninthMovePossible = if ((charAt(board, 8) == "0")) | |
217 | 219 | then 1 | |
218 | 220 | else 0 | |
219 | 221 | ((((((((firstMovePossible + secondMovePossible) + thirdMovePossible) + fourthMovePossible) + fifthMovePossible) + sixthMovePossible) + seventhMovePossible) + eigthMovePossible) + ninthMovePossible) | |
220 | 222 | } | |
221 | 223 | ||
222 | 224 | ||
223 | 225 | @Callable(i) | |
224 | 226 | func callback (gameIdAndBoard) = { | |
225 | 227 | let parts = split(gameIdAndBoard, "_") | |
226 | 228 | let gameId = parts[0] | |
227 | 229 | let board = parts[1] | |
228 | 230 | let nextPlayer = match getString(("next_player_" + gameId)) { | |
229 | 231 | case s: String => | |
230 | 232 | s | |
231 | 233 | case _ => | |
232 | 234 | "" | |
233 | 235 | } | |
234 | 236 | let moveOfAIIsValid = checkIfMoveIsValid(gameId, board) | |
235 | 237 | if (!(moveOfAIIsValid)) | |
236 | 238 | then throw("Illegal move!") | |
237 | 239 | else if ((nextPlayer != AI)) | |
238 | 240 | then throw("Player has to move first!") | |
239 | 241 | else { | |
240 | 242 | let aiHasWon = checkIfPlayerHasWon(gameId, board, AI) | |
241 | 243 | if (aiHasWon) | |
242 | 244 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")] | |
243 | 245 | else [StringEntry(("currentBoard_" + gameId), board), StringEntry(("next_player_" + gameId), PLAYER)] | |
244 | 246 | } | |
245 | 247 | } | |
246 | 248 | ||
247 | 249 | ||
248 | 250 | ||
249 | 251 | @Callable(i) | |
250 | 252 | func playTTT (game,board) = { | |
251 | 253 | let numberOfPayments = size(i.payments) | |
252 | 254 | if ((numberOfPayments != 1)) | |
253 | 255 | then throw("Payment necessary!") | |
254 | 256 | else { | |
255 | 257 | let payment = i.payments[0] | |
256 | 258 | let fee = payment.amount | |
257 | 259 | let feeAssetId = payment.assetId | |
258 | 260 | let minFee = match getInteger(Address(fromBase58String(BAI_CONTRACT)), "price_tictactoe") { | |
259 | 261 | case n: Int => | |
260 | 262 | n | |
261 | 263 | case _ => | |
262 | 264 | 0 | |
263 | 265 | } | |
264 | 266 | if (if ((feeAssetId != BAI_ASSET_ID)) | |
265 | 267 | then true | |
266 | 268 | else (minFee > fee)) | |
267 | 269 | then throw("Payment of the minimal BAI amount necessary!") | |
268 | 270 | else { | |
269 | 271 | let sender = i.caller | |
270 | 272 | let gameId = if ((size(game) == 0)) | |
271 | 273 | then toBase58String(i.transactionId) | |
272 | 274 | else game | |
273 | 275 | let nextPlayer = match getString(("next_player_" + gameId)) { | |
274 | 276 | case s: String => | |
275 | 277 | s | |
276 | 278 | case _ => | |
277 | 279 | PLAYER | |
278 | 280 | } | |
279 | 281 | if ((nextPlayer != PLAYER)) | |
280 | 282 | then throw("AI hast to move first!") | |
281 | 283 | else { | |
282 | 284 | let currentBoard = match getString(("currentBoard_" + gameId)) { | |
283 | 285 | case s: String => | |
284 | 286 | s | |
285 | 287 | case _ => | |
286 | 288 | board | |
287 | 289 | } | |
288 | 290 | let initiator = match getString(("initiator_" + gameId)) { | |
289 | 291 | case s: String => | |
290 | 292 | s | |
291 | 293 | case _ => | |
292 | 294 | toString(sender) | |
293 | 295 | } | |
294 | 296 | if ((toString(sender) != initiator)) | |
295 | 297 | then throw("Only initiator is allowed to make moves!") | |
296 | 298 | else { | |
297 | 299 | let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board) | |
298 | 300 | if (!(moveOfPlayerIsValid)) | |
299 | 301 | then throw("Illegal move!") | |
300 | 302 | else { | |
301 | 303 | let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER) | |
302 | 304 | let numberOfPossibleMoves = getPossibleMovesCount(board) | |
303 | 305 | if (playerHasWon) | |
304 | 306 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)] | |
305 | 307 | else if ((numberOfPossibleMoves == 0)) | |
306 | 308 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "draw")] | |
307 | 309 | else { | |
308 | 310 | let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)]) | |
309 | 311 | if ((nextMove == nextMove)) | |
310 | 312 | then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender)), StringEntry(("next_player_" + gameId), AI)] | |
311 | 313 | else throw("Strict value is not equal to itself.") | |
312 | 314 | } | |
313 | 315 | } | |
314 | 316 | } | |
315 | 317 | } | |
316 | 318 | } | |
317 | 319 | } | |
318 | 320 | } | |
319 | 321 | ||
320 | 322 | ||
321 | 323 | @Verifier(tx) | |
322 | 324 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
323 | 325 |
github/deemru/w8io/026f985 52.28 ms ◑