tx · BjhesTfFhPwSt7kshZq4BieM3G6R2TG9aPpRDGphDKxK

3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5:  -0.05000000 Waves

2024.07.21 19:32 [3204055] smart account 3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5 > SELF 0.00000000 Waves

{ "type": 13, "id": "BjhesTfFhPwSt7kshZq4BieM3G6R2TG9aPpRDGphDKxK", "fee": 5000000, "feeAssetId": null, "timestamp": 1721579599572, "version": 2, "chainId": 84, "sender": "3Mr1J95HgTFuj93Uh61WS1PBrxc5hSx5uE5", "senderPublicKey": "DhKSnv34wE65np8uDd8E6ygEbNsn6fHx9p7q4hJTcgRw", "proofs": [ "5Eo5nXtf4qKZ9TSEpixDqhLEvW83KHwcNfmbwTpcXYnzJ4xJdbdUEeV6Bri8aDcHFtMMDjCQ4J88nnPFz1CFvFXw" ], "script": "base64:AAIFAAAAAAAAAA0IAhIDCgEIEgQKAggIAAAACAAAAAAMQkFJX0NPTlRSQUNUAgAAACMzTjl0S2l4enFUWVduRVhReHJEUTVwQlRHdlFkNnNGc3ZtVgAAAAAMQkFJX0FTU0VUX0lEAQAAACCT4XI4cQSbauiaYx8EJLdkU5csPrxmC4N0r2i7JI3iQgAAAAAGUExBWUVSAgAAAAExAAAAAAJBSQIAAAABMgAAAAAOV0lOTklOR19BTU9VTlQAAAAAAAX14QABAAAABmNoYXJBdAAAAAIAAAADc3RyAAAAAWkJAAGRAAAAAgkABLUAAAACBQAAAANzdHICAAAAAAUAAAABaQEAAAASY2hlY2tJZk1vdmVJc1ZhbGlkAAAAAgAAAAZnYW1lSWQAAAAFYm9hcmQEAAAADGN1cnJlbnRCb2FyZAQAAAAHJG1hdGNoMAkABCIAAAABCQABLAAAAAICAAAADWN1cnJlbnRCb2FyZF8FAAAABmdhbWVJZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzAgAAAAkwMDAwMDA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2FtZUlkAgAAAAFfBQAAAAVib2FyZAkABEwAAAACAgAAAAl0aWN0YWN0b2UJAARMAAAAAgIAAAAIY2FsbGJhY2sFAAAAA25pbAkABEwAAAACCQEAAAAPQXR0YWNoZWRQYXltZW50AAAAAgUAAAAMQkFJX0FTU0VUX0lEAAAAAAAAmJaABQAAAANuaWwJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAA1jdXJyZW50Qm9hcmRfBQAAAAZnYW1lSWQFAAAABWJvYXJkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAKaW5pdGlhdG9yXwUAAAAGZ2FtZUlkCQAEJQAAAAEFAAAABnNlbmRlcgkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAADG5leHRfcGxheWVyXwUAAAAGZ2FtZUlkBQAAAAJBSQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXn0h5U5", "height": 3204055, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: SPqetXGRipro9J8gFUUwvLjRGBWDRrTpZY4e6uSDfgY Next: A35xkg7yd7RtaA1DB2hywUWCioEbXApN56kCDi4xRr8H Diff:
OldNewDifferences
189189 let parts = split(gameIdAndBoard, "_")
190190 let gameId = parts[0]
191191 let board = parts[1]
192+ let nextPlayer = match getString(("next_player_" + gameId)) {
193+ case s: String =>
194+ s
195+ case _ =>
196+ ""
197+ }
192198 let moveOfAIIsValid = checkIfMoveIsValid(gameId, board)
193- if (!(moveOfAIIsValid))
194- then throw("Illegal move!")
195- else {
196- let aiHasWon = checkIfPlayerHasWon(gameId, board, AI)
197- if (aiHasWon)
198- then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")]
199- else [StringEntry(("currentBoard_" + gameId), board)]
200- }
199+ if ((nextPlayer != AI))
200+ then throw("Player has to move first")
201+ else if (!(moveOfAIIsValid))
202+ then throw("Illegal move!")
203+ else {
204+ let aiHasWon = checkIfPlayerHasWon(gameId, board, AI)
205+ if (aiHasWon)
206+ then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")]
207+ else [StringEntry(("currentBoard_" + gameId), board), StringEntry(("next_player_" + gameId), PLAYER)]
208+ }
201209 }
202210
203211
226234 let gameId = if ((size(game) == 0))
227235 then toBase58String(i.transactionId)
228236 else game
229- let currentBoard = match getString(("currentBoard_" + gameId)) {
237+ let nextPlayer = match getString(("next_player_" + gameId)) {
230238 case s: String =>
231239 s
232240 case _ =>
233- board
241+ PLAYER
234242 }
235- let initiator = match getString(("initiator_" + gameId)) {
236- case s: String =>
237- s
238- case _ =>
239- sender
240- }
241- if ((sender != initiator))
242- then throw("Only initiator is allowed to make moves!")
243+ if ((nextPlayer != PLAYER))
244+ then throw("AI has to move first!")
243245 else {
244- let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board)
245- if (!(moveOfPlayerIsValid))
246- then throw("Illegal move!")
246+ let currentBoard = match getString(("currentBoard_" + gameId)) {
247+ case s: String =>
248+ s
249+ case _ =>
250+ board
251+ }
252+ let initiator = match getString(("initiator_" + gameId)) {
253+ case s: String =>
254+ s
255+ case _ =>
256+ sender
257+ }
258+ if ((sender != initiator))
259+ then throw("Only initiator is allowed to make moves!")
247260 else {
248- let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER)
249- if (playerHasWon)
250- then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)]
261+ let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board)
262+ if (!(moveOfPlayerIsValid))
263+ then throw("Illegal move!")
251264 else {
252- let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
253-[StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender))]
265+ let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER)
266+ if (playerHasWon)
267+ then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)]
268+ else {
269+ let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
270+[StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender)), StringEntry(("next_player_" + gameId), AI)]
271+ }
254272 }
255273 }
256274 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let BAI_CONTRACT = "3N9tKixzqTYWnEXQxrDQ5pBTGvQd6sFsvmV"
55
66 let BAI_ASSET_ID = base58'AxGKQRxKo4F2EbhrRq6N2tdLsxtMnpzQsS4QemV6V1W1'
77
88 let PLAYER = "1"
99
1010 let AI = "2"
1111
1212 let WINNING_AMOUNT = 100000000
1313
1414 func charAt (str,i) = split(str, "")[i]
1515
1616
1717 func checkIfMoveIsValid (gameId,board) = {
1818 let currentBoard = match getString(("currentBoard_" + gameId)) {
1919 case s: String =>
2020 s
2121 case _ =>
2222 "000000000"
2323 }
2424 let firstSelected = if ((charAt(board, 0) != charAt(currentBoard, 0)))
2525 then 1
2626 else 0
2727 let secondSelected = if ((charAt(board, 1) != charAt(currentBoard, 1)))
2828 then 1
2929 else 0
3030 let thirdSelected = if ((charAt(board, 2) != charAt(currentBoard, 2)))
3131 then 1
3232 else 0
3333 let fourthSelected = if ((charAt(board, 3) != charAt(currentBoard, 3)))
3434 then 1
3535 else 0
3636 let fifthSelected = if ((charAt(board, 4) != charAt(currentBoard, 4)))
3737 then 1
3838 else 0
3939 let sixthSelected = if ((charAt(board, 5) != charAt(currentBoard, 5)))
4040 then 1
4141 else 0
4242 let seventhSelected = if ((charAt(board, 6) != charAt(currentBoard, 6)))
4343 then 1
4444 else 0
4545 let eighthSelected = if ((charAt(board, 7) != charAt(currentBoard, 7)))
4646 then 1
4747 else 0
4848 let ninthSelected = if ((charAt(board, 8) != charAt(currentBoard, 8)))
4949 then 1
5050 else 0
5151 let firstPositionCorrect = if (if ((charAt(board, 0) == charAt(currentBoard, 0)))
5252 then true
5353 else (charAt(board, 0) == "0"))
5454 then true
5555 else false
5656 let secondPositionCorrect = if (if ((charAt(board, 1) == charAt(currentBoard, 1)))
5757 then true
5858 else (charAt(board, 1) == "0"))
5959 then true
6060 else false
6161 let thirdPositionCorrect = if (if ((charAt(board, 2) == charAt(currentBoard, 2)))
6262 then true
6363 else (charAt(board, 2) == "0"))
6464 then true
6565 else false
6666 let fourthPositionCorrect = if (if ((charAt(board, 3) == charAt(currentBoard, 3)))
6767 then true
6868 else (charAt(board, 3) == "0"))
6969 then true
7070 else false
7171 let fifthPositionCorrect = if (if ((charAt(board, 4) == charAt(currentBoard, 4)))
7272 then true
7373 else (charAt(board, 4) == "0"))
7474 then true
7575 else false
7676 let sixthPositionCorrect = if (if ((charAt(board, 5) == charAt(currentBoard, 5)))
7777 then true
7878 else (charAt(board, 5) == "0"))
7979 then true
8080 else false
8181 let seventhPositionCorrect = if (if ((charAt(board, 6) == charAt(currentBoard, 6)))
8282 then true
8383 else (charAt(board, 6) == "0"))
8484 then true
8585 else false
8686 let eighthPositionCorrect = if (if ((charAt(board, 7) == charAt(currentBoard, 7)))
8787 then true
8888 else (charAt(board, 7) == "0"))
8989 then true
9090 else false
9191 let ninthPositionCorrect = if (if ((charAt(board, 8) == charAt(currentBoard, 8)))
9292 then true
9393 else (charAt(board, 8) == "0"))
9494 then true
9595 else false
9696 let noOldPositionOverwritten = if (if (if (if (if (if (if (if (firstPositionCorrect)
9797 then secondPositionCorrect
9898 else false)
9999 then thirdPositionCorrect
100100 else false)
101101 then fourthPositionCorrect
102102 else false)
103103 then fifthPositionCorrect
104104 else false)
105105 then sixthPositionCorrect
106106 else false)
107107 then seventhPositionCorrect
108108 else false)
109109 then eighthPositionCorrect
110110 else false)
111111 then ninthPositionCorrect
112112 else false
113113 let countMoves = ((((((((firstSelected + secondSelected) + thirdSelected) + fourthSelected) + fifthSelected) + sixthSelected) + seventhSelected) + eighthSelected) + ninthSelected)
114114 let onlyOneMove = (1 >= countMoves)
115115 if (noOldPositionOverwritten)
116116 then onlyOneMove
117117 else false
118118 }
119119
120120
121121 func checkIfPlayerHasWon (gameId,board,player) = {
122122 let currentBoard = match getString(("currentBoard_" + gameId)) {
123123 case s: String =>
124124 s
125125 case _ =>
126126 "000000000"
127127 }
128128 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]]
129129 let topRow = if (if ((charAt(currentBoard, winningCombinations[0][0]) == player))
130130 then (charAt(currentBoard, winningCombinations[0][1]) == player)
131131 else false)
132132 then (charAt(currentBoard, winningCombinations[0][2]) == player)
133133 else false
134134 let middleRow = if (if ((charAt(currentBoard, winningCombinations[1][0]) == player))
135135 then (charAt(currentBoard, winningCombinations[1][1]) == player)
136136 else false)
137137 then (charAt(currentBoard, winningCombinations[1][2]) == player)
138138 else false
139139 let bottomRow = if (if ((charAt(currentBoard, winningCombinations[2][0]) == player))
140140 then (charAt(currentBoard, winningCombinations[2][1]) == player)
141141 else false)
142142 then (charAt(currentBoard, winningCombinations[2][2]) == player)
143143 else false
144144 let leftColumn = if (if ((charAt(currentBoard, winningCombinations[3][0]) == player))
145145 then (charAt(currentBoard, winningCombinations[3][1]) == player)
146146 else false)
147147 then (charAt(currentBoard, winningCombinations[3][2]) == player)
148148 else false
149149 let middleColumn = if (if ((charAt(currentBoard, winningCombinations[4][0]) == player))
150150 then (charAt(currentBoard, winningCombinations[4][1]) == player)
151151 else false)
152152 then (charAt(currentBoard, winningCombinations[4][2]) == player)
153153 else false
154154 let rightColumn = if (if ((charAt(currentBoard, winningCombinations[5][0]) == player))
155155 then (charAt(currentBoard, winningCombinations[5][1]) == player)
156156 else false)
157157 then (charAt(currentBoard, winningCombinations[5][2]) == player)
158158 else false
159159 let diagonalOne = if (if ((charAt(currentBoard, winningCombinations[6][0]) == player))
160160 then (charAt(currentBoard, winningCombinations[6][1]) == player)
161161 else false)
162162 then (charAt(currentBoard, winningCombinations[6][2]) == player)
163163 else false
164164 let diagonalTwo = if (if ((charAt(currentBoard, winningCombinations[7][0]) == player))
165165 then (charAt(currentBoard, winningCombinations[7][1]) == player)
166166 else false)
167167 then (charAt(currentBoard, winningCombinations[7][2]) == player)
168168 else false
169169 if (if (if (if (if (if (if (topRow)
170170 then true
171171 else middleRow)
172172 then true
173173 else bottomRow)
174174 then true
175175 else leftColumn)
176176 then true
177177 else middleRow)
178178 then true
179179 else rightColumn)
180180 then true
181181 else diagonalOne)
182182 then true
183183 else diagonalTwo
184184 }
185185
186186
187187 @Callable(i)
188188 func callback (gameIdAndBoard) = {
189189 let parts = split(gameIdAndBoard, "_")
190190 let gameId = parts[0]
191191 let board = parts[1]
192+ let nextPlayer = match getString(("next_player_" + gameId)) {
193+ case s: String =>
194+ s
195+ case _ =>
196+ ""
197+ }
192198 let moveOfAIIsValid = checkIfMoveIsValid(gameId, board)
193- if (!(moveOfAIIsValid))
194- then throw("Illegal move!")
195- else {
196- let aiHasWon = checkIfPlayerHasWon(gameId, board, AI)
197- if (aiHasWon)
198- then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")]
199- else [StringEntry(("currentBoard_" + gameId), board)]
200- }
199+ if ((nextPlayer != AI))
200+ then throw("Player has to move first")
201+ else if (!(moveOfAIIsValid))
202+ then throw("Illegal move!")
203+ else {
204+ let aiHasWon = checkIfPlayerHasWon(gameId, board, AI)
205+ if (aiHasWon)
206+ then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "ai")]
207+ else [StringEntry(("currentBoard_" + gameId), board), StringEntry(("next_player_" + gameId), PLAYER)]
208+ }
201209 }
202210
203211
204212
205213 @Callable(i)
206214 func playTTT (game,board) = {
207215 let numberOfPayments = size(i.payments)
208216 if ((numberOfPayments != 1))
209217 then throw("Payment necessary!")
210218 else {
211219 let payment = i.payments[0]
212220 let fee = payment.amount
213221 let feeAssetId = payment.assetId
214222 let minFee = match getInteger(Address(fromBase58String(BAI_CONTRACT)), "price_tictactoe") {
215223 case n: Int =>
216224 n
217225 case _ =>
218226 0
219227 }
220228 if (if ((feeAssetId != BAI_ASSET_ID))
221229 then true
222230 else (minFee > fee))
223231 then throw("Payment of the minimal BAI amount necessary!")
224232 else {
225233 let sender = i.caller
226234 let gameId = if ((size(game) == 0))
227235 then toBase58String(i.transactionId)
228236 else game
229- let currentBoard = match getString(("currentBoard_" + gameId)) {
237+ let nextPlayer = match getString(("next_player_" + gameId)) {
230238 case s: String =>
231239 s
232240 case _ =>
233- board
241+ PLAYER
234242 }
235- let initiator = match getString(("initiator_" + gameId)) {
236- case s: String =>
237- s
238- case _ =>
239- sender
240- }
241- if ((sender != initiator))
242- then throw("Only initiator is allowed to make moves!")
243+ if ((nextPlayer != PLAYER))
244+ then throw("AI has to move first!")
243245 else {
244- let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board)
245- if (!(moveOfPlayerIsValid))
246- then throw("Illegal move!")
246+ let currentBoard = match getString(("currentBoard_" + gameId)) {
247+ case s: String =>
248+ s
249+ case _ =>
250+ board
251+ }
252+ let initiator = match getString(("initiator_" + gameId)) {
253+ case s: String =>
254+ s
255+ case _ =>
256+ sender
257+ }
258+ if ((sender != initiator))
259+ then throw("Only initiator is allowed to make moves!")
247260 else {
248- let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER)
249- if (playerHasWon)
250- then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)]
261+ let moveOfPlayerIsValid = checkIfMoveIsValid(gameId, board)
262+ if (!(moveOfPlayerIsValid))
263+ then throw("Illegal move!")
251264 else {
252- let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
253-[StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender))]
265+ let playerHasWon = checkIfPlayerHasWon(gameId, board, PLAYER)
266+ if (playerHasWon)
267+ then [StringEntry(("currentBoard_" + gameId), board), StringEntry(("winner_" + gameId), "player"), ScriptTransfer(sender, WINNING_AMOUNT, BAI_ASSET_ID)]
268+ else {
269+ let nextMove = invoke(Address(fromBase58String(BAI_CONTRACT)), "registerTaskCallback", [((gameId + "_") + board), "tictactoe", "callback"], [AttachedPayment(BAI_ASSET_ID, 10000000)])
270+[StringEntry(("currentBoard_" + gameId), board), StringEntry(("initiator_" + gameId), toString(sender)), StringEntry(("next_player_" + gameId), AI)]
271+ }
254272 }
255273 }
256274 }
257275 }
258276 }
259277 }
260278
261279
262280 @Verifier(tx)
263281 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
264282

github/deemru/w8io/026f985 
38.58 ms