tx · Ds9KxLV24az8RMis5XerfUMDoT2cF1mVmccBTZTJmUDw

3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV:  -0.01000000 Waves

2021.12.08 21:20 [1825625] smart account 3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV > SELF 0.00000000 Waves

{ "type": 13, "id": "Ds9KxLV24az8RMis5XerfUMDoT2cF1mVmccBTZTJmUDw", "fee": 1000000, "feeAssetId": null, "timestamp": 1638987627244, "version": 2, "chainId": 84, "sender": "3N7Gg64FJ3ESaqn41qu1ete7zmzbmoP1AAV", "senderPublicKey": "5amLtMwixiEesBDKPy9dkFWntG2fNxhTs5n69JbQE9F7", "proofs": [ "2v1rKzyXGEFrA2t2dCaXHSJ3h7e9aFkq4Qq1GQaTDD3Dk9vg3MY2ZhWyiUJLLKG1URqKFWuWXUqprC8xgDgVkhob" ], "script": "base64:AAIFAAAAAAAAABoIAhIAEgUKAwgICBIDCgEIEgMKAQgSAwoBCAAAAAEAAAAABXNlcGFyAgAAAAF8AAAABQAAAAFpAQAAAAVyZXNldAAAAAAJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAKbGFzdGdhbWVpZAIAAAABMAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAA9sYXN0Y2hhbGxlbmdlaWQCAAAAATAFAAAAA25pbAAAAAFpAQAAAAVtb292ZQAAAAMAAAAGZ2FtZWlkAAAABGZyb20AAAACdG8EAAAABGdhbWUJAAS1AAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQkAASwAAAACAgAAAAVnYW1lLQUAAAAGZ2FtZWlkBQAAAAVzZXBhcgMJAAAAAAAAAgkAAZEAAAACBQAAAARnYW1lAAAAAAAAAAAAAgAAAAdvbmdvaW5nBAAAAAxjYWxsZXJBZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMDCQAAAAAAAAIJAAGRAAAAAgUAAAAEZ2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AAAAAAAAAAMFAAAAA25pbAUAAAAFc2VwYXIFAAAAA25pbAkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwkAAAIAAAABAgAAABRjaGFsbGVuZ2Ugbm90IGV4aXN0cwAAAABZrMnk", "height": 1825625, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AfqZMB8M7w5gyxBeZGWS7Js1NTVEVfXi7pJjUUZrvryn Next: 2Cz1nVhJ7CuEHYvMiAwa7yGLbPqyUHYtcFgmR9wShtjX Diff:
OldNewDifferences
99
1010
1111 @Callable(b)
12-func startgame (c) = {
13- let d = if ((size(b.payments) == 1))
12+func moove (c,d,e) = {
13+ let f = split(getStringValue(("game-" + c)), a)
14+ if ((f[0] == "ongoing"))
15+ then {
16+ let g = toBase58String(b.caller.bytes)
17+ if (if ((f[1] == g))
18+ then true
19+ else (f[2] == g))
20+ then {
21+ let h = if ((f[1] == g))
22+ then "w"
23+ else "b"
24+ if ((f[5] == h))
25+ then {
26+ let i = f[8]
27+ let j = split(e, "")
28+ if (if (contains(i, d))
29+ then (j[3] != h)
30+ else false)
31+ then {
32+ let k = split(d, "")
33+ let l = k[5]
34+ let m = parseIntValue(k[0])
35+ let n = parseIntValue(k[1])
36+ let o = parseIntValue(j[0])
37+ let p = parseIntValue(j[1])
38+ let q = split(i, "||")
39+ let r = [split(q[0], "|"), split(q[1], "|"), split(q[2], "|"), split(q[3], "|"), split(q[4], "|"), split(q[5], "|"), split(q[6], "|"), split(q[7], "|")]
40+ if ((l == "p"))
41+ then if ((h == "w"))
42+ then if ((j[3] == "b"))
43+ then if (if (((n - p) == 1))
44+ then if (((m - o) == 1))
45+ then true
46+ else ((m - o) == 1)
47+ else false)
48+ then [StringEntry("-", "-")]
49+ else throw("incorrect eating")
50+ else {
51+ let s = split(r[m][(n - 1)], "")
52+ let t = if ((s[3] == "0"))
53+ then true
54+ else false
55+ if (if ((m == o))
56+ then if (((n - o) == 1))
57+ then true
58+ else if (((m - o) == 2))
59+ then t
60+ else false
61+ else false)
62+ then [StringEntry("moved", ((("from-" + d) + " to-") + e))]
63+ else throw("incorrect move")
64+ }
65+ else [StringEntry("-", "-")]
66+ else [StringEntry("-", "-")]
67+ }
68+ else throw("not siotuation")
69+ }
70+ else throw("not your turn")
71+ }
72+ else throw("not gamer")
73+ }
74+ else throw("not ongoing game")
75+ }
76+
77+
78+
79+@Callable(b)
80+func startgame (u) = {
81+ let v = if ((size(b.payments) == 1))
1482 then b.payments[0]
1583 else throw("must stake some waves")
16- if (isDefined(d.assetId))
84+ if (isDefined(v.assetId))
1785 then throw("works with waves only")
1886 else {
19- let e = toBase58String(b.caller.bytes)
20- let f = split(getStringValue(("challenge-" + c)), a)
21- if ((size(f) > 0))
22- then if ((d.amount >= parseIntValue(f[3])))
23- then if ((f[0] == "awaiting"))
87+ let g = toBase58String(b.caller.bytes)
88+ let w = split(getStringValue(("challenge-" + u)), a)
89+ if ((size(w) > 0))
90+ then if ((v.amount >= parseIntValue(w[3])))
91+ then if ((w[0] == "awaiting"))
2492 then {
25- let g = if ((f[2] == "black"))
26- then f[1]
27- else e
28- let h = if ((f[2] == "white"))
29- then f[1]
30- else e
31- let i = toString((parseIntValue(getStringValue("lastgameid")) + 1))
32-[StringEntry(("challenge-" + c), makeString([i, f[1], f[2], f[3], e], a)), StringEntry(("game-" + i), makeString(["ongoing", h, g, f[3], "0", "white", "startblock", "laststepblock"], a)), StringEntry("lastgameid", i), ScriptTransfer(b.caller, (d.amount - parseIntValue(f[3])), unit)]
93+ let x = if ((w[2] == "black"))
94+ then w[1]
95+ else g
96+ let y = if ((w[2] == "white"))
97+ then w[1]
98+ else g
99+ let c = toString((parseIntValue(getStringValue("lastgameid")) + 1))
100+[StringEntry(("challenge-" + u), makeString([c, w[1], w[2], w[3], g], a)), {
101+ let i = "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"
102+ StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "white", "startblock", "laststepblock", i], a))
103+ }, StringEntry("lastgameid", c), ScriptTransfer(b.caller, (v.amount - parseIntValue(w[3])), unit)]
33104 }
34105 else throw("no challenge awaiting")
35106 else throw("need more money")
40111
41112
42113 @Callable(b)
43-func setchallenge (j) = if (if ((j == "black"))
114+func setchallenge (h) = if (if ((h == "black"))
44115 then true
45- else (j == "white"))
116+ else (h == "white"))
46117 then {
47- let d = if ((size(b.payments) == 1))
118+ let v = if ((size(b.payments) == 1))
48119 then b.payments[0]
49120 else throw("must stake some waves")
50- if (isDefined(d.assetId))
121+ if (isDefined(v.assetId))
51122 then throw("works with waves only")
52123 else {
53- let e = toBase58String(b.caller.bytes)
54- let c = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
55-[StringEntry(("challenge-" + c), makeString(["awaiting", e, j, toString(d.amount)], a)), StringEntry("lastchallengeid", c)]
124+ let g = toBase58String(b.caller.bytes)
125+ let u = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
126+[StringEntry(("challenge-" + u), makeString(["awaiting", g, h, toString(v.amount)], a)), StringEntry("lastchallengeid", u)]
56127 }
57128 }
58129 else throw("invalid side")
60131
61132
62133 @Callable(b)
63-func unsetchallenge (k) = {
64- let e = toBase58String(b.caller.bytes)
65- func l (k) = {
66- let m = getString(("challenge-" + k))
67- if ($isInstanceOf(m, "String"))
134+func unsetchallenge (z) = {
135+ let g = toBase58String(b.caller.bytes)
136+ func A (z) = {
137+ let B = getString(("challenge-" + z))
138+ if ($isInstanceOf(B, "String"))
68139 then {
69- let n = m
70- getStringValue(("challenge-" + k))
140+ let C = B
141+ getStringValue(("challenge-" + z))
71142 }
72143 else ""
73144 }
74145
75- let o = split(l(k), a)
76- if ((size(o) > 0))
77- then if ((o[0] == "awaiting"))
78- then [StringEntry(("challenge-" + k), makeString(["unset", o[1], o[2], o[3]], a))]
146+ let D = split(A(z), a)
147+ if ((size(D) > 0))
148+ then if ((D[0] == "awaiting"))
149+ then [StringEntry(("challenge-" + z), makeString(["unset", D[1], D[2], D[3]], a))]
79150 else throw("challenge not exists")
80151 else throw("challenge not exists")
81152 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "|"
55
66 @Callable(b)
77 func reset () = [StringEntry("lastgameid", "0"), StringEntry("lastchallengeid", "0")]
88
99
1010
1111 @Callable(b)
12-func startgame (c) = {
13- let d = if ((size(b.payments) == 1))
12+func moove (c,d,e) = {
13+ let f = split(getStringValue(("game-" + c)), a)
14+ if ((f[0] == "ongoing"))
15+ then {
16+ let g = toBase58String(b.caller.bytes)
17+ if (if ((f[1] == g))
18+ then true
19+ else (f[2] == g))
20+ then {
21+ let h = if ((f[1] == g))
22+ then "w"
23+ else "b"
24+ if ((f[5] == h))
25+ then {
26+ let i = f[8]
27+ let j = split(e, "")
28+ if (if (contains(i, d))
29+ then (j[3] != h)
30+ else false)
31+ then {
32+ let k = split(d, "")
33+ let l = k[5]
34+ let m = parseIntValue(k[0])
35+ let n = parseIntValue(k[1])
36+ let o = parseIntValue(j[0])
37+ let p = parseIntValue(j[1])
38+ let q = split(i, "||")
39+ let r = [split(q[0], "|"), split(q[1], "|"), split(q[2], "|"), split(q[3], "|"), split(q[4], "|"), split(q[5], "|"), split(q[6], "|"), split(q[7], "|")]
40+ if ((l == "p"))
41+ then if ((h == "w"))
42+ then if ((j[3] == "b"))
43+ then if (if (((n - p) == 1))
44+ then if (((m - o) == 1))
45+ then true
46+ else ((m - o) == 1)
47+ else false)
48+ then [StringEntry("-", "-")]
49+ else throw("incorrect eating")
50+ else {
51+ let s = split(r[m][(n - 1)], "")
52+ let t = if ((s[3] == "0"))
53+ then true
54+ else false
55+ if (if ((m == o))
56+ then if (((n - o) == 1))
57+ then true
58+ else if (((m - o) == 2))
59+ then t
60+ else false
61+ else false)
62+ then [StringEntry("moved", ((("from-" + d) + " to-") + e))]
63+ else throw("incorrect move")
64+ }
65+ else [StringEntry("-", "-")]
66+ else [StringEntry("-", "-")]
67+ }
68+ else throw("not siotuation")
69+ }
70+ else throw("not your turn")
71+ }
72+ else throw("not gamer")
73+ }
74+ else throw("not ongoing game")
75+ }
76+
77+
78+
79+@Callable(b)
80+func startgame (u) = {
81+ let v = if ((size(b.payments) == 1))
1482 then b.payments[0]
1583 else throw("must stake some waves")
16- if (isDefined(d.assetId))
84+ if (isDefined(v.assetId))
1785 then throw("works with waves only")
1886 else {
19- let e = toBase58String(b.caller.bytes)
20- let f = split(getStringValue(("challenge-" + c)), a)
21- if ((size(f) > 0))
22- then if ((d.amount >= parseIntValue(f[3])))
23- then if ((f[0] == "awaiting"))
87+ let g = toBase58String(b.caller.bytes)
88+ let w = split(getStringValue(("challenge-" + u)), a)
89+ if ((size(w) > 0))
90+ then if ((v.amount >= parseIntValue(w[3])))
91+ then if ((w[0] == "awaiting"))
2492 then {
25- let g = if ((f[2] == "black"))
26- then f[1]
27- else e
28- let h = if ((f[2] == "white"))
29- then f[1]
30- else e
31- let i = toString((parseIntValue(getStringValue("lastgameid")) + 1))
32-[StringEntry(("challenge-" + c), makeString([i, f[1], f[2], f[3], e], a)), StringEntry(("game-" + i), makeString(["ongoing", h, g, f[3], "0", "white", "startblock", "laststepblock"], a)), StringEntry("lastgameid", i), ScriptTransfer(b.caller, (d.amount - parseIntValue(f[3])), unit)]
93+ let x = if ((w[2] == "black"))
94+ then w[1]
95+ else g
96+ let y = if ((w[2] == "white"))
97+ then w[1]
98+ else g
99+ let c = toString((parseIntValue(getStringValue("lastgameid")) + 1))
100+[StringEntry(("challenge-" + u), makeString([c, w[1], w[2], w[3], g], a)), {
101+ let i = "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"
102+ StringEntry(("game-" + c), makeString(["ongoing", y, x, w[3], "0", "white", "startblock", "laststepblock", i], a))
103+ }, StringEntry("lastgameid", c), ScriptTransfer(b.caller, (v.amount - parseIntValue(w[3])), unit)]
33104 }
34105 else throw("no challenge awaiting")
35106 else throw("need more money")
36107 else throw("no challenge")
37108 }
38109 }
39110
40111
41112
42113 @Callable(b)
43-func setchallenge (j) = if (if ((j == "black"))
114+func setchallenge (h) = if (if ((h == "black"))
44115 then true
45- else (j == "white"))
116+ else (h == "white"))
46117 then {
47- let d = if ((size(b.payments) == 1))
118+ let v = if ((size(b.payments) == 1))
48119 then b.payments[0]
49120 else throw("must stake some waves")
50- if (isDefined(d.assetId))
121+ if (isDefined(v.assetId))
51122 then throw("works with waves only")
52123 else {
53- let e = toBase58String(b.caller.bytes)
54- let c = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
55-[StringEntry(("challenge-" + c), makeString(["awaiting", e, j, toString(d.amount)], a)), StringEntry("lastchallengeid", c)]
124+ let g = toBase58String(b.caller.bytes)
125+ let u = toString((parseIntValue(getStringValue("lastchallengeid")) + 1))
126+[StringEntry(("challenge-" + u), makeString(["awaiting", g, h, toString(v.amount)], a)), StringEntry("lastchallengeid", u)]
56127 }
57128 }
58129 else throw("invalid side")
59130
60131
61132
62133 @Callable(b)
63-func unsetchallenge (k) = {
64- let e = toBase58String(b.caller.bytes)
65- func l (k) = {
66- let m = getString(("challenge-" + k))
67- if ($isInstanceOf(m, "String"))
134+func unsetchallenge (z) = {
135+ let g = toBase58String(b.caller.bytes)
136+ func A (z) = {
137+ let B = getString(("challenge-" + z))
138+ if ($isInstanceOf(B, "String"))
68139 then {
69- let n = m
70- getStringValue(("challenge-" + k))
140+ let C = B
141+ getStringValue(("challenge-" + z))
71142 }
72143 else ""
73144 }
74145
75- let o = split(l(k), a)
76- if ((size(o) > 0))
77- then if ((o[0] == "awaiting"))
78- then [StringEntry(("challenge-" + k), makeString(["unset", o[1], o[2], o[3]], a))]
146+ let D = split(A(z), a)
147+ if ((size(D) > 0))
148+ then if ((D[0] == "awaiting"))
149+ then [StringEntry(("challenge-" + z), makeString(["unset", D[1], D[2], D[3]], a))]
79150 else throw("challenge not exists")
80151 else throw("challenge not exists")
81152 }
82153
83154

github/deemru/w8io/169f3d6 
53.36 ms