tx · 864xNvJnBUwTCzZirzdsRzE6TPcHiAWuqeka1L9W3xwp

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.09 08:50 [1826307] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "864xNvJnBUwTCzZirzdsRzE6TPcHiAWuqeka1L9W3xwp", "fee": 1000000, "feeAssetId": null, "timestamp": 1639029035349, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "4q8b6C5Xamb1tTMcP5Dfy5yQnoGYjccvu4Yrzy8efWAYCL6gXCxkZRfKE89BK5VB8MtrCShtGAQ6gPwrV65U8bFK" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAEAAAAABXNlcGFyAgAAAAF8AAAABQAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAKbGFzdGdhbWVpZAIAAAABMAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9sYXN0Y2hhbGxlbmdlaWQCAAAAATAFAAAAA25pbAAAAAFpAQAAAARtb3ZlAAAAAwAAAAZnYW1laWQAAAAEZnJvbQAAAAJ0bwQAAAAEZ2FtZQkABLUAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAABWdhbWUtBQAAAAZnYW1laWQFAAAABXNlcGFyAwkAAAAAAAACBQAAAARnYW1lBQAAAARnYW1lBAAAAAxjYWxsZXJBZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAgUAAAAMY2FsbGVyQWRyZXNzBQAAAAxjYWxsZXJBZHJlc3MEAAAABmlzZ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MAkABCIAAAABCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwCQEAAAARQGV4dHJOYXRpdmUoMTA1OCkAAAABCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAIAAAAABAAAAAljaGFsbGVuZ2UJAAS1AAAAAgkBAAAADGdldGNoYWxsZW5nZQAAAAEFAAAADGNoYWxsZW5kZ2VpZAUAAAAFc2VwYXIDCQAAZgAAAAIJAAGQAAAAAQUAAAAJY2hhbGxlbmdlAAAAAAAAAAAAAwkAAAAAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAAIAAAAIYXdhaXRpbmcJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAApjaGFsbGVuZ2UtBQAAAAxjaGFsbGVuZGdlaWQJAAS5AAAAAgkABEwAAAACAgAAAAV1bnNldAkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAQkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAgkABEwAAAACCQABkQAAAAIFAAAACWNoYWxsZW5nZQAAAAAAAAAAAwUAAAADbmlsBQAAAAVzZXBhcgUAAAADbmlsCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzCQAAAgAAAAECAAAAFGNoYWxsZW5nZSBub3QgZXhpc3RzAAAAACDseAY=", "height": 1826307, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4QxjvxHg76BRbog9kQer2hUfmQuaeF7hPWjy7ozWYGLA Next: HymfQyQYfauW4g7s6GCVPJpQRAFbXr2UeYmMEDHhDBby Diff:
OldNewDifferences
99
1010
1111 @Callable(i)
12-func moove (gameid,from,to) = {
12+func move (gameid,from,to) = {
1313 let game = split(getStringValue(("game-" + gameid)), separ)
14- if ((game[0] == "ongoing"))
14+ if ((game == game))
1515 then {
1616 let callerAdress = toBase58String(i.caller.bytes)
17- if (if ((game[1] == callerAdress))
18- then true
19- else (game[2] == callerAdress))
17+ if ((callerAdress == callerAdress))
2018 then {
21- let side = if ((game[1] == callerAdress))
22- then "w"
23- else "b"
24- if ((game[5] == side))
19+ let isgame = if ((game[0] == "ongoing"))
20+ then true
21+ else throw("not ongoing game")
22+ if ((isgame == isgame))
2523 then {
26- let tolist = split(to, "")
27- let fromlist = split(from, "")
28- let figure = fromlist[5]
29- let fromx = parseIntValue(fromlist[0])
30- let fromy = parseIntValue(fromlist[1])
31- let tox = parseIntValue(tolist[0])
32- let toy = parseIntValue(tolist[1])
33- let situation = game[8]
34- let rows = split(situation, "||")
35- let cell = [split(rows[0], "|"), split(rows[1], "|"), split(rows[2], "|"), split(rows[3], "|"), split(rows[4], "|"), split(rows[5], "|"), split(rows[6], "|"), split(rows[7], "|")]
36- if (if ((cell[fromx][fromy] == from))
37- then (cell[tox][toy] == to)
24+ let side = if (if (isgame)
25+ then if ((game[1] == callerAdress))
26+ then true
27+ else (game[2] == callerAdress)
3828 else false)
39- then if ((figure == "p"))
40- then if ((side == "w"))
41- then if ((tolist[3] == "b"))
42- then if (if (((fromy - toy) == 1))
43- then if (((fromx - tox) == 1))
44- then true
45- else ((fromx - tox) == 1)
46- else false)
47- then [StringEntry("-", "-")]
48- else throw("incorrect eating")
49- else {
50- let c = split(cell[fromx][(fromy - 1)], "")
51- let freecell = if ((c[3] == "0"))
52- then true
53- else false
54- if (if ((fromx == tox))
55- then if (((fromy - tox) == 1))
29+ then if ((game[1] == callerAdress))
30+ then "w"
31+ else "b"
32+ else throw("not gamer")
33+ if ((side == side))
34+ then {
35+ let turn = if ((side == game[5]))
36+ then true
37+ else throw("not your turn")
38+ if ((turn == turn))
39+ then {
40+ let situation = split(game[8], "||")
41+ 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], "|")]
42+ if ((cells == cells))
43+ then {
44+ let froms = split(from, "")
45+ let tos = split(to, "")
46+ let fromx = parseIntValue(froms[0])
47+ let fromy = parseIntValue(froms[1])
48+ let tox = parseIntValue(tos[0])
49+ let toy = parseIntValue(tos[1])
50+ let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
51+ then (take(cells[tox][toy], 1) != side)
52+ else false)
5653 then true
57- else if (((fromx - tox) == 2))
58- then freecell
59- else false
60- else false)
61- then [StringEntry("moved", ((("from-" + from) + " to-") + to))]
62- else throw("incorrect move")
63- }
64- else [StringEntry("-", "-")]
65- else [StringEntry("-", "-")]
66- else throw("not situation")
54+ else throw("wrong position")
55+ if ((iscorrect == iscorrect))
56+ then {
57+ let figure = cells[fromx][fromy]
58+ if (iscorrect)
59+ then [StringEntry("_", "figure")]
60+ else [StringEntry("_", "_")]
61+ }
62+ else throw("Strict value is not equal to itself.")
63+ }
64+ else throw("Strict value is not equal to itself.")
65+ }
66+ else throw("Strict value is not equal to itself.")
67+ }
68+ else throw("Strict value is not equal to itself.")
6769 }
68- else throw("not your turn")
70+ else throw("Strict value is not equal to itself.")
6971 }
70- else throw("not gamer")
72+ else throw("Strict value is not equal to itself.")
7173 }
72- else throw("not ongoing game")
74+ else throw("Strict value is not equal to itself.")
7375 }
7476
7577
9698 else callerAdress
9799 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
98100 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
99- let situation = "00:w:l|10:w:h|20:w:e|30:w:f|40:w:q|50:w:e|60:w:h|70:w:l||01:w:p|11:w:p|21:w:p|31:w:p|41:w:p|51:w:p|61:w:p|71:w:p||02:0:0|12:0:0|22:0:0|32:0:0|42:0:0|52:0:0|62:0:0|72:0:0||03:0:0|13:0:0|23:0:0|33:0:0|43:0:0|53:0:0|63:0:0|73:0:0||04:0:0|14:0:0|24:0:0|34:0:0|44:0:0|54:0:0|64:0:0|74:0:0||05:0:0|15:0:0|25:0:0|35:0:0|45:0:0|55:0:0|65:0:0|75:0:0||06:b:p|16:w:p|26:w:p|36:w:p|46:w:p|56:w:p|66:w:p|76:w:p||07:b:l|17:b:h|27:b:e|37:b:f|47:b:q|57:b:e|67:b:h|77:b:l"
101+ let situation = "wl|wh|we|wf|wq|we|wh|wl||wp|wp|wp|wp|wp|wp|wp|wp||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||bp|bp|bp|bp|bp|bp|bp|bp||bl|bh|be|bf|bq|be|bh|bl"
100102 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
101103 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
102104 }
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)
12-func moove (gameid,from,to) = {
12+func move (gameid,from,to) = {
1313 let game = split(getStringValue(("game-" + gameid)), separ)
14- if ((game[0] == "ongoing"))
14+ if ((game == game))
1515 then {
1616 let callerAdress = toBase58String(i.caller.bytes)
17- if (if ((game[1] == callerAdress))
18- then true
19- else (game[2] == callerAdress))
17+ if ((callerAdress == callerAdress))
2018 then {
21- let side = if ((game[1] == callerAdress))
22- then "w"
23- else "b"
24- if ((game[5] == side))
19+ let isgame = if ((game[0] == "ongoing"))
20+ then true
21+ else throw("not ongoing game")
22+ if ((isgame == isgame))
2523 then {
26- let tolist = split(to, "")
27- let fromlist = split(from, "")
28- let figure = fromlist[5]
29- let fromx = parseIntValue(fromlist[0])
30- let fromy = parseIntValue(fromlist[1])
31- let tox = parseIntValue(tolist[0])
32- let toy = parseIntValue(tolist[1])
33- let situation = game[8]
34- let rows = split(situation, "||")
35- let cell = [split(rows[0], "|"), split(rows[1], "|"), split(rows[2], "|"), split(rows[3], "|"), split(rows[4], "|"), split(rows[5], "|"), split(rows[6], "|"), split(rows[7], "|")]
36- if (if ((cell[fromx][fromy] == from))
37- then (cell[tox][toy] == to)
24+ let side = if (if (isgame)
25+ then if ((game[1] == callerAdress))
26+ then true
27+ else (game[2] == callerAdress)
3828 else false)
39- then if ((figure == "p"))
40- then if ((side == "w"))
41- then if ((tolist[3] == "b"))
42- then if (if (((fromy - toy) == 1))
43- then if (((fromx - tox) == 1))
44- then true
45- else ((fromx - tox) == 1)
46- else false)
47- then [StringEntry("-", "-")]
48- else throw("incorrect eating")
49- else {
50- let c = split(cell[fromx][(fromy - 1)], "")
51- let freecell = if ((c[3] == "0"))
52- then true
53- else false
54- if (if ((fromx == tox))
55- then if (((fromy - tox) == 1))
29+ then if ((game[1] == callerAdress))
30+ then "w"
31+ else "b"
32+ else throw("not gamer")
33+ if ((side == side))
34+ then {
35+ let turn = if ((side == game[5]))
36+ then true
37+ else throw("not your turn")
38+ if ((turn == turn))
39+ then {
40+ let situation = split(game[8], "||")
41+ 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], "|")]
42+ if ((cells == cells))
43+ then {
44+ let froms = split(from, "")
45+ let tos = split(to, "")
46+ let fromx = parseIntValue(froms[0])
47+ let fromy = parseIntValue(froms[1])
48+ let tox = parseIntValue(tos[0])
49+ let toy = parseIntValue(tos[1])
50+ let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
51+ then (take(cells[tox][toy], 1) != side)
52+ else false)
5653 then true
57- else if (((fromx - tox) == 2))
58- then freecell
59- else false
60- else false)
61- then [StringEntry("moved", ((("from-" + from) + " to-") + to))]
62- else throw("incorrect move")
63- }
64- else [StringEntry("-", "-")]
65- else [StringEntry("-", "-")]
66- else throw("not situation")
54+ else throw("wrong position")
55+ if ((iscorrect == iscorrect))
56+ then {
57+ let figure = cells[fromx][fromy]
58+ if (iscorrect)
59+ then [StringEntry("_", "figure")]
60+ else [StringEntry("_", "_")]
61+ }
62+ else throw("Strict value is not equal to itself.")
63+ }
64+ else throw("Strict value is not equal to itself.")
65+ }
66+ else throw("Strict value is not equal to itself.")
67+ }
68+ else throw("Strict value is not equal to itself.")
6769 }
68- else throw("not your turn")
70+ else throw("Strict value is not equal to itself.")
6971 }
70- else throw("not gamer")
72+ else throw("Strict value is not equal to itself.")
7173 }
72- else throw("not ongoing game")
74+ else throw("Strict value is not equal to itself.")
7375 }
7476
7577
7678
7779 @Callable(i)
7880 func startgame (challengeid) = {
7981 let pmt = if ((size(i.payments) == 1))
8082 then i.payments[0]
8183 else throw("must stake some waves")
8284 if (isDefined(pmt.assetId))
8385 then throw("works with waves only")
8486 else {
8587 let callerAdress = toBase58String(i.caller.bytes)
8688 let conditions = split(getStringValue(("challenge-" + challengeid)), separ)
8789 if ((size(conditions) > 0))
8890 then if ((pmt.amount >= parseIntValue(conditions[3])))
8991 then if ((conditions[0] == "awaiting"))
9092 then {
9193 let black = if ((conditions[2] == "b"))
9294 then conditions[1]
9395 else callerAdress
9496 let white = if ((conditions[2] == "w"))
9597 then conditions[1]
9698 else callerAdress
9799 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
98100 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
99- let situation = "00:w:l|10:w:h|20:w:e|30:w:f|40:w:q|50:w:e|60:w:h|70:w:l||01:w:p|11:w:p|21:w:p|31:w:p|41:w:p|51:w:p|61:w:p|71:w:p||02:0:0|12:0:0|22:0:0|32:0:0|42:0:0|52:0:0|62:0:0|72:0:0||03:0:0|13:0:0|23:0:0|33:0:0|43:0:0|53:0:0|63:0:0|73:0:0||04:0:0|14:0:0|24:0:0|34:0:0|44:0:0|54:0:0|64:0:0|74:0:0||05:0:0|15:0:0|25:0:0|35:0:0|45:0:0|55:0:0|65:0:0|75:0:0||06:b:p|16:w:p|26:w:p|36:w:p|46:w:p|56:w:p|66:w:p|76:w:p||07:b:l|17:b:h|27:b:e|37:b:f|47:b:q|57:b:e|67:b:h|77:b:l"
101+ let situation = "wl|wh|we|wf|wq|we|wh|wl||wp|wp|wp|wp|wp|wp|wp|wp||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||00|00|00|00|00|00|00|00||bp|bp|bp|bp|bp|bp|bp|bp||bl|bh|be|bf|bq|be|bh|bl"
100102 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
101103 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
102104 }
103105 else throw("no challenge awaiting")
104106 else throw("need more money")
105107 else throw("no challenge")
106108 }
107109 }
108110
109111
110112
111113 @Callable(i)
112114 func setchallenge (side) = if (if ((side == "b"))
113115 then true
114116 else (side == "w"))
115117 then {
116118 let pmt = if ((size(i.payments) == 1))
117119 then i.payments[0]
118120 else throw("must stake some waves")
119121 if (isDefined(pmt.assetId))
120122 then throw("works with waves only")
121123 else {
122124 let callerAdress = toBase58String(i.caller.bytes)
123125 let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
124126 [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)]
125127 }
126128 }
127129 else throw("invalid side")
128130
129131
130132
131133 @Callable(i)
132134 func unsetchallenge (challendgeid) = {
133135 let callerAdress = toBase58String(i.caller.bytes)
134136 func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) {
135137 case a: String =>
136138 getStringValue(("challenge-" + challendgeid))
137139 case _ =>
138140 ""
139141 }
140142
141143 let challenge = split(getchallenge(challendgeid), separ)
142144 if ((size(challenge) > 0))
143145 then if ((challenge[0] == "awaiting"))
144146 then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))]
145147 else throw("challenge not exists")
146148 else throw("challenge not exists")
147149 }
148150
149151

github/deemru/w8io/169f3d6 
53.34 ms