3 | | - | let contract = tx.sender |
---|
4 | | - | let fields = extract(getInteger(contract, "field")) |
---|
5 | | - | let cell1 = (fields % 10) |
---|
6 | | - | let cell2 = ((fields / 10) % 10) |
---|
7 | | - | let cell3 = ((fields / 100) % 10) |
---|
8 | | - | let cell4 = ((fields / 1000) % 10) |
---|
9 | | - | let cell5 = ((fields / 10000) % 10) |
---|
10 | | - | let cell6 = ((fields / 100000) % 10) |
---|
11 | | - | let cell7 = ((fields / 1000000) % 10) |
---|
12 | | - | let cell8 = ((fields / 10000000) % 10) |
---|
13 | | - | let cell9 = ((fields / 100000000) % 10) |
---|
14 | | - | let line1 = ((cell1 + cell2) + cell3) |
---|
15 | | - | let line2 = ((cell4 + cell5) + cell6) |
---|
16 | | - | let line3 = ((cell7 + cell8) + cell9) |
---|
17 | | - | let column1 = ((cell1 + cell4) + cell7) |
---|
18 | | - | let column2 = ((cell2 + cell5) + cell8) |
---|
19 | | - | let column3 = ((cell3 + cell6) + cell9) |
---|
20 | | - | let diagonal1 = ((cell1 + cell5) + cell9) |
---|
21 | | - | let diagonal2 = ((cell3 + cell5) + cell7) |
---|
22 | | - | let all = ((line1 + line2) + line3) |
---|
23 | | - | let crossNum = (all % 10) |
---|
24 | | - | let zeroNum = ((all - crossNum) / 10) |
---|
25 | | - | let crossWin = if (if (if (if (if (if (if ((line1 == 3)) |
---|
26 | | - | then true |
---|
27 | | - | else (line2 == 3)) |
---|
28 | | - | then true |
---|
29 | | - | else (line3 == 3)) |
---|
30 | | - | then true |
---|
31 | | - | else (column1 == 3)) |
---|
32 | | - | then true |
---|
33 | | - | else (column2 == 3)) |
---|
34 | | - | then true |
---|
35 | | - | else (column3 == 3)) |
---|
36 | | - | then true |
---|
37 | | - | else (diagonal1 == 3)) |
---|
38 | | - | then true |
---|
39 | | - | else (diagonal2 == 3) |
---|
40 | | - | let zeroWin = if (if (if (if (if (if (if ((line1 == 27)) |
---|
41 | | - | then true |
---|
42 | | - | else (line2 == 27)) |
---|
43 | | - | then true |
---|
44 | | - | else (line3 == 27)) |
---|
45 | | - | then true |
---|
46 | | - | else (column1 == 27)) |
---|
47 | | - | then true |
---|
48 | | - | else (column2 == 27)) |
---|
49 | | - | then true |
---|
50 | | - | else (column3 == 27)) |
---|
51 | | - | then true |
---|
52 | | - | else (diagonal1 == 27)) |
---|
53 | | - | then true |
---|
54 | | - | else (diagonal2 == 27) |
---|
55 | | - | match tx { |
---|
56 | | - | case t: DataTransaction => |
---|
57 | | - | if (!(crossWin)) |
---|
58 | | - | then !(zeroWin) |
---|
59 | | - | else false |
---|
60 | | - | case payout: TransferTransaction => |
---|
61 | | - | false |
---|
62 | | - | case _ => |
---|
63 | | - | true |
---|
64 | | - | } |
---|
| 3 | + | true |
---|