tx · GZMrG7JyroYqqGmd9FjGxe9S8JVQQzSqJHRAXCeKw5Us

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.09 11:33 [1826467] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "GZMrG7JyroYqqGmd9FjGxe9S8JVQQzSqJHRAXCeKw5Us", "fee": 1000000, "feeAssetId": null, "timestamp": 1639038831325, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "2we1U2n7nDudkMeHvcaoyPNMdesvAwWuxb1m6JuL86YirxQEhs2HCWRqk63q9N1mRKSLAakhY1zDQPuguwoLCLHT" ], "script": "base64:AAIFAAAAAAAAAB4IAhIAEgASBwoFCAEBAQESAwoBCBIDCgEIEgMKAQgAAAABAAAAAAVzZXBhcgIAAAABfAAAAAYAAAABaQEAAAAFcmVzZXQAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAACmxhc3RnYW1laWQCAAAAATAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAPbGFzdGNoYWxsZW5nZWlkAgAAAAEwBQAAAANuaWwAAAABaQEAAAAIc2V0cnVsZXMAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG1iZisCAAAACi0xLC0xfDEsLTEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAEbWJmLQIAAAAACQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG13ZisCAAAACC0xLDF8MSwxCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG13Zi0CAAAAAAUAAAADbmlsAAAAAWkBAAAABG1vdmUAAAAFAAAABmdhbWVpZAAAAAVmcm9te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AAADbmlsCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzAAAAALAUqvA=", "height": 1826467, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 25WvUy1u3nNvmdtSEsLmqGQbgeBMi14Lc6PKtwihd7ra Next: CX9YSC8TWoA2Mk2nXvFEjDzpaJQ8hVwww45gWQCpKi8r Diff:
OldNewDifferences
1414
1515
1616 @Callable(i)
17-func move (gameid,from,to) = {
17+func move (gameid,fromx,fromy,tox,toy) = {
1818 let game = split(getStringValue(("game-" + gameid)), separ)
1919 if ((game == game))
2020 then {
4949 let cells = [split(situation[0], "-"), split(situation[1], "|"), split(situation[2], "|"), split(situation[3], "|"), split(situation[4], "|"), split(situation[5], "|"), split(situation[6], "|"), split(situation[7], "|")]
5050 if ((cells == cells))
5151 then {
52- let fromx = parseIntValue(take(from, 1))
53- let fromy = parseIntValue(takeRight(from, 1))
54- let tox = parseIntValue(take(to, 1))
55- let toy = parseIntValue(takeRight(to, 1))
5652 let figure = takeRight(cells[fromx][fromy], 1)
5753 let movetype = if ((take(cells[tox][toy], 1) == "0"))
5854 then "m"
6662 else throw("incorrect movement")
6763 if (iscorrect)
6864 then [StringEntry("_", "possible")]
69- else [StringEntry("_", "_")]
65+ else throw("impossible movement")
7066 }
7167 else throw("Strict value is not equal to itself.")
7268 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separ = "|"
55
66 @Callable(i)
77 func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")]
88
99
1010
1111 @Callable(i)
1212 func setrules () = [StringEntry("mbf+", "-1,-1|1,-1"), StringEntry("mbf-", ""), StringEntry("mwf+", "-1,1|1,1"), StringEntry("mwf-", "")]
1313
1414
1515
1616 @Callable(i)
17-func move (gameid,from,to) = {
17+func move (gameid,fromx,fromy,tox,toy) = {
1818 let game = split(getStringValue(("game-" + gameid)), separ)
1919 if ((game == game))
2020 then {
2121 let callerAdress = toBase58String(i.caller.bytes)
2222 if ((callerAdress == callerAdress))
2323 then {
2424 let isgame = if ((game[0] == "ongoing"))
2525 then true
2626 else throw("not ongoing game")
2727 if ((isgame == isgame))
2828 then {
2929 let side = if (if (isgame)
3030 then if ((game[1] == callerAdress))
3131 then true
3232 else (game[2] == callerAdress)
3333 else false)
3434 then if ((game[1] == callerAdress))
3535 then "w"
3636 else "b"
3737 else throw("not gamer")
3838 if ((side == side))
3939 then {
4040 let otherside = if ((side == "w"))
4141 then "b"
4242 else "w"
4343 let turn = if ((side == game[5]))
4444 then true
4545 else throw("not your turn")
4646 if ((turn == turn))
4747 then {
4848 let situation = split(game[8], "!")
4949 let cells = [split(situation[0], "-"), split(situation[1], "|"), split(situation[2], "|"), split(situation[3], "|"), split(situation[4], "|"), split(situation[5], "|"), split(situation[6], "|"), split(situation[7], "|")]
5050 if ((cells == cells))
5151 then {
52- let fromx = parseIntValue(take(from, 1))
53- let fromy = parseIntValue(takeRight(from, 1))
54- let tox = parseIntValue(take(to, 1))
55- let toy = parseIntValue(takeRight(to, 1))
5652 let figure = takeRight(cells[fromx][fromy], 1)
5753 let movetype = if ((take(cells[tox][toy], 1) == "0"))
5854 then "m"
5955 else if ((take(cells[tox][toy], 1) == otherside))
6056 then "e"
6157 else throw("can not eat himself")
6258 let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy)))
6359 let possible = split(getStringValue(((movetype + side) + figure)), "|")
6460 let iscorrect = if (containsElement(possible, movement))
6561 then true
6662 else throw("incorrect movement")
6763 if (iscorrect)
6864 then [StringEntry("_", "possible")]
69- else [StringEntry("_", "_")]
65+ else throw("impossible movement")
7066 }
7167 else throw("Strict value is not equal to itself.")
7268 }
7369 else throw("Strict value is not equal to itself.")
7470 }
7571 else throw("Strict value is not equal to itself.")
7672 }
7773 else throw("Strict value is not equal to itself.")
7874 }
7975 else throw("Strict value is not equal to itself.")
8076 }
8177 else throw("Strict value is not equal to itself.")
8278 }
8379
8480
8581
8682 @Callable(i)
8783 func startgame (challengeid) = {
8884 let pmt = if ((size(i.payments) == 1))
8985 then i.payments[0]
9086 else throw("must stake some waves")
9187 if (isDefined(pmt.assetId))
9288 then throw("works with waves only")
9389 else {
9490 let callerAdress = toBase58String(i.caller.bytes)
9591 let conditions = split(getStringValue(("challenge-" + challengeid)), separ)
9692 if ((size(conditions) > 0))
9793 then if ((pmt.amount >= parseIntValue(conditions[3])))
9894 then if ((conditions[0] == "awaiting"))
9995 then {
10096 let black = if ((conditions[2] == "b"))
10197 then conditions[1]
10298 else callerAdress
10399 let white = if ((conditions[2] == "w"))
104100 then conditions[1]
105101 else callerAdress
106102 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
107103 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
108104 let situation = "wf-00-wf-00-wf-00-wf-00!00-wf-00-wf-00-wf-00-wf!wf-00-wf-00-wf-00-wf-00!00-00-00-00-00-00-00-00!00-00-00-00-00-00-00-00!00-bf-00-bf-00-bf-00-bf!bf-00-bf-00-bf-00-bf-00!00-bf-00-bf-00-bf-00-bf"
109105 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
110106 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
111107 }
112108 else throw("no challenge awaiting")
113109 else throw("need more money")
114110 else throw("no challenge")
115111 }
116112 }
117113
118114
119115
120116 @Callable(i)
121117 func setchallenge (side) = if (if ((side == "b"))
122118 then true
123119 else (side == "w"))
124120 then {
125121 let pmt = if ((size(i.payments) == 1))
126122 then i.payments[0]
127123 else throw("must stake some waves")
128124 if (isDefined(pmt.assetId))
129125 then throw("works with waves only")
130126 else {
131127 let callerAdress = toBase58String(i.caller.bytes)
132128 let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
133129 [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)]
134130 }
135131 }
136132 else throw("invalid side")
137133
138134
139135
140136 @Callable(i)
141137 func unsetchallenge (challendgeid) = {
142138 let callerAdress = toBase58String(i.caller.bytes)
143139 func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) {
144140 case a: String =>
145141 getStringValue(("challenge-" + challendgeid))
146142 case _ =>
147143 ""
148144 }
149145
150146 let challenge = split(getchallenge(challendgeid), separ)
151147 if ((size(challenge) > 0))
152148 then if ((challenge[0] == "awaiting"))
153149 then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))]
154150 else throw("challenge not exists")
155151 else throw("challenge not exists")
156152 }
157153
158154

github/deemru/w8io/026f985 
34.74 ms