tx · 8y2C3N3BzQKupBcKKues5evvGR3kara3EbGrfG9wPDHW

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.09 11:16 [1826450] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "8y2C3N3BzQKupBcKKues5evvGR3kara3EbGrfG9wPDHW", "fee": 1000000, "feeAssetId": null, "timestamp": 1639037795164, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "43AxxEJLSfVcN9MJ9GFPmq9ZXCkcsKJrkVA2Qb8FweZ2z3JEDJ5FkGioeoWt2v9v4SHHZfxYUJwEgJdtNPkSg2Dj" ], "script": "base64:AAIFAAAAAAAAABwIAhIAEgASBQoDCAgIEgMKAQgSAwoBCBIDCgEIAAAAAQAAAAAFc2VwYXICAAAAAXwAAAAGAAAAAWkBAAAABXJlc2V0AAAAAAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAApsYXN0Z2FtZWlkAgAAAAEwCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAD2xhc3RjaGFsbGVuZ2VpZAIAAAABMAUAAAADbmlsAAAAAWkBAAAACHNldHJ1bGVzAAAAAAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAANtYisCAAAACi0xLC0xfDEsLTEJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAADbWItAgAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAADbXcrAgAAAAgtMSwxfDEsMQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAANtYi0CAAAAAAUAAAADbmlsAAAAAWkBAAAABG1vdmUAAAADAAAABmdhbWVpZAAAAARmcm9tAAAAAnRvBA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AAACCQABLAAAAAICAAAACmNoYWxsZW5nZS0FAAAADGNoYWxsZW5kZ2VpZAkABLkAAAACCQAETAAAAAICAAAABXVuc2V0CQAETAAAAAIJAAGRAAAAAgUAAAAJY2hhbGxlbmdlAAAAAAAAAAABCQAETAAAAAIJAAGRAAAAAgUAAAAJY2hhbGxlbmdlAAAAAAAAAAACCQAETAAAAAIJAAGRAAAAAgUAAAAJY2hhbGxlbmdlAAAAAAAAAAADBQAAAANuaWwFAAAABXNlcGFyBQAAAANuaWwJAAACAAAAAQIAAAAUY2hhbGxlbmdlIG5vdCBleGlzdHMJAAACAAAAAQIAAAAUY2hhbGxlbmdlIG5vdCBleGlzdHMAAAAA3C4zuA==", "height": 1826450, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 448Fi4XgqUcsuV9nLh91QhYQrMfBeRumHXyuBNj5fjFE Next: 25WvUy1u3nNvmdtSEsLmqGQbgeBMi14Lc6PKtwihd7ra Diff:
OldNewDifferences
55
66 @Callable(i)
77 func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")]
8+
9+
10+
11+@Callable(i)
12+func setrules () = [StringEntry("mb+", "-1,-1|1,-1"), StringEntry("mb-", ""), StringEntry("mw+", "-1,1|1,1"), StringEntry("mb-", "")]
813
914
1015
3237 else throw("not gamer")
3338 if ((side == side))
3439 then {
40+ let otherside = if ((side == "w"))
41+ then "b"
42+ else "w"
3543 let turn = if ((side == game[5]))
3644 then true
3745 else throw("not your turn")
4553 let fromy = parseIntValue(takeRight(from, 1))
4654 let tox = parseIntValue(take(to, 1))
4755 let toy = parseIntValue(takeRight(to, 1))
48- let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
49- then (take(cells[tox][toy], 1) != side)
50- else false)
56+ let figure = takeRight(cells[fromx][fromy], 1)
57+ let movetype = if ((take(cells[tox][toy], 1) == "0"))
58+ then "m"
59+ else if ((take(cells[tox][toy], 1) == otherside))
60+ then "e"
61+ else throw("can not eat himself")
62+ let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy)))
63+ let possible = split(getStringValue((movetype + figure)), "|")
64+ let iscorrect = if (containsElement(possible, movement))
5165 then true
52- else throw("wrong position")
53- if ((iscorrect == iscorrect))
54- then {
55- let figure = cells[fromx][fromy]
56- if (iscorrect)
57- then [StringEntry("_", "figure")]
58- else [StringEntry("_", "_")]
59- }
60- else throw("Strict value is not equal to itself.")
66+ else throw("incorrect movement")
67+ if (iscorrect)
68+ then [StringEntry("_", "figure")]
69+ else [StringEntry("_", "_")]
6170 }
6271 else throw("Strict value is not equal to itself.")
6372 }
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")]
8+
9+
10+
11+@Callable(i)
12+func setrules () = [StringEntry("mb+", "-1,-1|1,-1"), StringEntry("mb-", ""), StringEntry("mw+", "-1,1|1,1"), StringEntry("mb-", "")]
813
914
1015
1116 @Callable(i)
1217 func move (gameid,from,to) = {
1318 let game = split(getStringValue(("game-" + gameid)), separ)
1419 if ((game == game))
1520 then {
1621 let callerAdress = toBase58String(i.caller.bytes)
1722 if ((callerAdress == callerAdress))
1823 then {
1924 let isgame = if ((game[0] == "ongoing"))
2025 then true
2126 else throw("not ongoing game")
2227 if ((isgame == isgame))
2328 then {
2429 let side = if (if (isgame)
2530 then if ((game[1] == callerAdress))
2631 then true
2732 else (game[2] == callerAdress)
2833 else false)
2934 then if ((game[1] == callerAdress))
3035 then "w"
3136 else "b"
3237 else throw("not gamer")
3338 if ((side == side))
3439 then {
40+ let otherside = if ((side == "w"))
41+ then "b"
42+ else "w"
3543 let turn = if ((side == game[5]))
3644 then true
3745 else throw("not your turn")
3846 if ((turn == turn))
3947 then {
4048 let situation = split(game[8], "!")
4149 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], "|")]
4250 if ((cells == cells))
4351 then {
4452 let fromx = parseIntValue(take(from, 1))
4553 let fromy = parseIntValue(takeRight(from, 1))
4654 let tox = parseIntValue(take(to, 1))
4755 let toy = parseIntValue(takeRight(to, 1))
48- let iscorrect = if (if ((take(cells[fromx][fromy], 1) == side))
49- then (take(cells[tox][toy], 1) != side)
50- else false)
56+ let figure = takeRight(cells[fromx][fromy], 1)
57+ let movetype = if ((take(cells[tox][toy], 1) == "0"))
58+ then "m"
59+ else if ((take(cells[tox][toy], 1) == otherside))
60+ then "e"
61+ else throw("can not eat himself")
62+ let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy)))
63+ let possible = split(getStringValue((movetype + figure)), "|")
64+ let iscorrect = if (containsElement(possible, movement))
5165 then true
52- else throw("wrong position")
53- if ((iscorrect == iscorrect))
54- then {
55- let figure = cells[fromx][fromy]
56- if (iscorrect)
57- then [StringEntry("_", "figure")]
58- else [StringEntry("_", "_")]
59- }
60- else throw("Strict value is not equal to itself.")
66+ else throw("incorrect movement")
67+ if (iscorrect)
68+ then [StringEntry("_", "figure")]
69+ else [StringEntry("_", "_")]
6170 }
6271 else throw("Strict value is not equal to itself.")
6372 }
6473 else throw("Strict value is not equal to itself.")
6574 }
6675 else throw("Strict value is not equal to itself.")
6776 }
6877 else throw("Strict value is not equal to itself.")
6978 }
7079 else throw("Strict value is not equal to itself.")
7180 }
7281 else throw("Strict value is not equal to itself.")
7382 }
7483
7584
7685
7786 @Callable(i)
7887 func startgame (challengeid) = {
7988 let pmt = if ((size(i.payments) == 1))
8089 then i.payments[0]
8190 else throw("must stake some waves")
8291 if (isDefined(pmt.assetId))
8392 then throw("works with waves only")
8493 else {
8594 let callerAdress = toBase58String(i.caller.bytes)
8695 let conditions = split(getStringValue(("challenge-" + challengeid)), separ)
8796 if ((size(conditions) > 0))
8897 then if ((pmt.amount >= parseIntValue(conditions[3])))
8998 then if ((conditions[0] == "awaiting"))
9099 then {
91100 let black = if ((conditions[2] == "b"))
92101 then conditions[1]
93102 else callerAdress
94103 let white = if ((conditions[2] == "w"))
95104 then conditions[1]
96105 else callerAdress
97106 let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1))
98107 [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), {
99108 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"
100109 StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ))
101110 }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)]
102111 }
103112 else throw("no challenge awaiting")
104113 else throw("need more money")
105114 else throw("no challenge")
106115 }
107116 }
108117
109118
110119
111120 @Callable(i)
112121 func setchallenge (side) = if (if ((side == "b"))
113122 then true
114123 else (side == "w"))
115124 then {
116125 let pmt = if ((size(i.payments) == 1))
117126 then i.payments[0]
118127 else throw("must stake some waves")
119128 if (isDefined(pmt.assetId))
120129 then throw("works with waves only")
121130 else {
122131 let callerAdress = toBase58String(i.caller.bytes)
123132 let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
124133 [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)]
125134 }
126135 }
127136 else throw("invalid side")
128137
129138
130139
131140 @Callable(i)
132141 func unsetchallenge (challendgeid) = {
133142 let callerAdress = toBase58String(i.caller.bytes)
134143 func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) {
135144 case a: String =>
136145 getStringValue(("challenge-" + challendgeid))
137146 case _ =>
138147 ""
139148 }
140149
141150 let challenge = split(getchallenge(challendgeid), separ)
142151 if ((size(challenge) > 0))
143152 then if ((challenge[0] == "awaiting"))
144153 then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))]
145154 else throw("challenge not exists")
146155 else throw("challenge not exists")
147156 }
148157
149158

github/deemru/w8io/026f985 
28.96 ms