tx · 25WvUy1u3nNvmdtSEsLmqGQbgeBMi14Lc6PKtwihd7ra 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV: -0.01000000 Waves 2021.12.09 11:27 [1826461] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves
{ "type": 13, "id": "25WvUy1u3nNvmdtSEsLmqGQbgeBMi14Lc6PKtwihd7ra", "fee": 1000000, "feeAssetId": null, "timestamp": 1639038478990, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "2TA1jGBC9SSnNxLNyV7roZ1fWujx7J5bjdxQBodCqSsKpqjug7wnmJi76qYTZnWbXpH1PYWzTaEaSVVBXoUruVzX" ], "script": "base64:AAIFAAAAAAAAABwIAhIAEgASBQoDCAgIEgMKAQgSAwoBCBIDCgEIAAAAAQAAAAAFc2VwYXICAAAAAXwAAAAGAAAAAWkBAAAABXJlc2V0AAAAAAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAApsYXN0Z2FtZWlkAgAAAAEwCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAD2xhc3RjaGFsbGVuZ2VpZAIAAAABMAUAAAADbmlsAAAAAWkBAAAACHNldHJ1bGVzAAAAAAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAARtYmYrAgAAAAotMSwtMXwxLC0xCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABG1iZi0CAAAAAAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAARtd2YrAgAAAAgtMSwxfDEsMQkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAARtd2YtAgAAAAAFAAAAA25pbAAAAAFpAQAAAARtb3ZlAAAAAwAAAAZnYW1laWQAAAAEZnJvbQAAAAJ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mdFbnRyeQAAAAIJAAEsAAAAAgIAAAAKY2hhbGxlbmdlLQUAAAAMY2hhbGxlbmRnZWlkCQAEuQAAAAIJAARMAAAAAgIAAAAFdW5zZXQJAARMAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAEJAARMAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAIJAARMAAAAAgkAAZEAAAACBQAAAAljaGFsbGVuZ2UAAAAAAAAAAAMFAAAAA25pbAUAAAAFc2VwYXIFAAAAA25pbAkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwAAAADAFgkh", "height": 1826461, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8y2C3N3BzQKupBcKKues5evvGR3kara3EbGrfG9wPDHW Next: GZMrG7JyroYqqGmd9FjGxe9S8JVQQzSqJHRAXCeKw5Us Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | ||
11 | 11 | @Callable(i) | |
12 | - | func setrules () = [StringEntry(" | |
12 | + | func setrules () = [StringEntry("mbf+", "-1,-1|1,-1"), StringEntry("mbf-", ""), StringEntry("mwf+", "-1,1|1,1"), StringEntry("mwf-", "")] | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
60 | 60 | then "e" | |
61 | 61 | else throw("can not eat himself") | |
62 | 62 | let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy))) | |
63 | - | let possible = split(getStringValue((movetype + figure)), "|") | |
63 | + | let possible = split(getStringValue(((movetype + side) + figure)), "|") | |
64 | 64 | let iscorrect = if (containsElement(possible, movement)) | |
65 | 65 | then true | |
66 | 66 | else throw("incorrect movement") | |
67 | 67 | if (iscorrect) | |
68 | - | then [StringEntry("_", " | |
68 | + | then [StringEntry("_", "possible")] | |
69 | 69 | else [StringEntry("_", "_")] | |
70 | 70 | } | |
71 | 71 | else throw("Strict value is not equal to itself.") | |
105 | 105 | else callerAdress | |
106 | 106 | let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
107 | 107 | [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), { | |
108 | - | let situation = " | |
108 | + | 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" | |
109 | 109 | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ)) | |
110 | 110 | }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)] | |
111 | 111 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separ = "|" | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")] | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | 11 | @Callable(i) | |
12 | - | func setrules () = [StringEntry(" | |
12 | + | func setrules () = [StringEntry("mbf+", "-1,-1|1,-1"), StringEntry("mbf-", ""), StringEntry("mwf+", "-1,1|1,1"), StringEntry("mwf-", "")] | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
16 | 16 | @Callable(i) | |
17 | 17 | func move (gameid,from,to) = { | |
18 | 18 | let game = split(getStringValue(("game-" + gameid)), separ) | |
19 | 19 | if ((game == game)) | |
20 | 20 | then { | |
21 | 21 | let callerAdress = toBase58String(i.caller.bytes) | |
22 | 22 | if ((callerAdress == callerAdress)) | |
23 | 23 | then { | |
24 | 24 | let isgame = if ((game[0] == "ongoing")) | |
25 | 25 | then true | |
26 | 26 | else throw("not ongoing game") | |
27 | 27 | if ((isgame == isgame)) | |
28 | 28 | then { | |
29 | 29 | let side = if (if (isgame) | |
30 | 30 | then if ((game[1] == callerAdress)) | |
31 | 31 | then true | |
32 | 32 | else (game[2] == callerAdress) | |
33 | 33 | else false) | |
34 | 34 | then if ((game[1] == callerAdress)) | |
35 | 35 | then "w" | |
36 | 36 | else "b" | |
37 | 37 | else throw("not gamer") | |
38 | 38 | if ((side == side)) | |
39 | 39 | then { | |
40 | 40 | let otherside = if ((side == "w")) | |
41 | 41 | then "b" | |
42 | 42 | else "w" | |
43 | 43 | let turn = if ((side == game[5])) | |
44 | 44 | then true | |
45 | 45 | else throw("not your turn") | |
46 | 46 | if ((turn == turn)) | |
47 | 47 | then { | |
48 | 48 | let situation = split(game[8], "!") | |
49 | 49 | 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], "|")] | |
50 | 50 | if ((cells == cells)) | |
51 | 51 | then { | |
52 | 52 | let fromx = parseIntValue(take(from, 1)) | |
53 | 53 | let fromy = parseIntValue(takeRight(from, 1)) | |
54 | 54 | let tox = parseIntValue(take(to, 1)) | |
55 | 55 | let toy = parseIntValue(takeRight(to, 1)) | |
56 | 56 | let figure = takeRight(cells[fromx][fromy], 1) | |
57 | 57 | let movetype = if ((take(cells[tox][toy], 1) == "0")) | |
58 | 58 | then "m" | |
59 | 59 | else if ((take(cells[tox][toy], 1) == otherside)) | |
60 | 60 | then "e" | |
61 | 61 | else throw("can not eat himself") | |
62 | 62 | let movement = ((toString((fromx - tox)) + ",") + toString((fromy - toy))) | |
63 | - | let possible = split(getStringValue((movetype + figure)), "|") | |
63 | + | let possible = split(getStringValue(((movetype + side) + figure)), "|") | |
64 | 64 | let iscorrect = if (containsElement(possible, movement)) | |
65 | 65 | then true | |
66 | 66 | else throw("incorrect movement") | |
67 | 67 | if (iscorrect) | |
68 | - | then [StringEntry("_", " | |
68 | + | then [StringEntry("_", "possible")] | |
69 | 69 | else [StringEntry("_", "_")] | |
70 | 70 | } | |
71 | 71 | else throw("Strict value is not equal to itself.") | |
72 | 72 | } | |
73 | 73 | else throw("Strict value is not equal to itself.") | |
74 | 74 | } | |
75 | 75 | else throw("Strict value is not equal to itself.") | |
76 | 76 | } | |
77 | 77 | else throw("Strict value is not equal to itself.") | |
78 | 78 | } | |
79 | 79 | else throw("Strict value is not equal to itself.") | |
80 | 80 | } | |
81 | 81 | else throw("Strict value is not equal to itself.") | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | ||
86 | 86 | @Callable(i) | |
87 | 87 | func startgame (challengeid) = { | |
88 | 88 | let pmt = if ((size(i.payments) == 1)) | |
89 | 89 | then i.payments[0] | |
90 | 90 | else throw("must stake some waves") | |
91 | 91 | if (isDefined(pmt.assetId)) | |
92 | 92 | then throw("works with waves only") | |
93 | 93 | else { | |
94 | 94 | let callerAdress = toBase58String(i.caller.bytes) | |
95 | 95 | let conditions = split(getStringValue(("challenge-" + challengeid)), separ) | |
96 | 96 | if ((size(conditions) > 0)) | |
97 | 97 | then if ((pmt.amount >= parseIntValue(conditions[3]))) | |
98 | 98 | then if ((conditions[0] == "awaiting")) | |
99 | 99 | then { | |
100 | 100 | let black = if ((conditions[2] == "b")) | |
101 | 101 | then conditions[1] | |
102 | 102 | else callerAdress | |
103 | 103 | let white = if ((conditions[2] == "w")) | |
104 | 104 | then conditions[1] | |
105 | 105 | else callerAdress | |
106 | 106 | let gameid = toString((parseIntValue(getStringValue("lastgameid")) + 1)) | |
107 | 107 | [StringEntry(("challenge-" + challengeid), makeString([gameid, conditions[1], conditions[2], conditions[3], callerAdress], separ)), { | |
108 | - | let situation = " | |
108 | + | 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" | |
109 | 109 | StringEntry(("game-" + gameid), makeString(["ongoing", white, black, conditions[3], "0", "w", "startblock", "laststepblock", situation], separ)) | |
110 | 110 | }, StringEntry("lastgameid", gameid), ScriptTransfer(i.caller, (pmt.amount - parseIntValue(conditions[3])), unit)] | |
111 | 111 | } | |
112 | 112 | else throw("no challenge awaiting") | |
113 | 113 | else throw("need more money") | |
114 | 114 | else throw("no challenge") | |
115 | 115 | } | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func setchallenge (side) = if (if ((side == "b")) | |
122 | 122 | then true | |
123 | 123 | else (side == "w")) | |
124 | 124 | then { | |
125 | 125 | let pmt = if ((size(i.payments) == 1)) | |
126 | 126 | then i.payments[0] | |
127 | 127 | else throw("must stake some waves") | |
128 | 128 | if (isDefined(pmt.assetId)) | |
129 | 129 | then throw("works with waves only") | |
130 | 130 | else { | |
131 | 131 | let callerAdress = toBase58String(i.caller.bytes) | |
132 | 132 | let challengeid = toString((parseIntValue(getStringValue("lastchallengeid")) + 1)) | |
133 | 133 | [StringEntry(("challenge-" + challengeid), makeString(["awaiting", callerAdress, side, toString(pmt.amount)], separ)), StringEntry("lastchallengeid", challengeid)] | |
134 | 134 | } | |
135 | 135 | } | |
136 | 136 | else throw("invalid side") | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(i) | |
141 | 141 | func unsetchallenge (challendgeid) = { | |
142 | 142 | let callerAdress = toBase58String(i.caller.bytes) | |
143 | 143 | func getchallenge (challendgeid) = match getString(("challenge-" + challendgeid)) { | |
144 | 144 | case a: String => | |
145 | 145 | getStringValue(("challenge-" + challendgeid)) | |
146 | 146 | case _ => | |
147 | 147 | "" | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | let challenge = split(getchallenge(challendgeid), separ) | |
151 | 151 | if ((size(challenge) > 0)) | |
152 | 152 | then if ((challenge[0] == "awaiting")) | |
153 | 153 | then [StringEntry(("challenge-" + challendgeid), makeString(["unset", challenge[1], challenge[2], challenge[3]], separ))] | |
154 | 154 | else throw("challenge not exists") | |
155 | 155 | else throw("challenge not exists") | |
156 | 156 | } | |
157 | 157 | ||
158 | 158 |
github/deemru/w8io/026f985 35.55 ms ◑