-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathjxltree.py
80 lines (71 loc) · 1.67 KB
/
jxltree.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import random
TEMPLATE = """RCT 0
if x > {x1}
if c > 1
- Set {set1b}
if c > 0
- Set {set1g}
- Set {set1r}
if x > {x2}
if c > 1
- Set {set2b}
if c > 0
- Set {set2g}
- Set {set2r}
if c > 1
- Set {set3b}
if c > 0
- Set {set3g}
- Set {set3r}
"""
def generate_res(seed: str, cost: int = 0) -> str:
r = random.Random(seed)
for _ in range(cost):
r.randint(0, 1000)
x1 = r.randint(650, 750)
x2 = r.randint(300, 400)
# while x2 == x1:
# x2 = r.randint(0, 1000)
# if x1 < x2:
# x1, x2 = x2, x1
bs = []; gs = []; rs = []
set1b = r.randint(0, 255); bs.append(set1b)
set1g = r.randint(0, 255); gs.append(set1g)
set1r = r.randint(0, 255); rs.append(set1r)
set2b = r.randint(0, 255)
while set2b in bs:
set2b = r.randint(0, 255)
bs.append(set2b)
set2g = r.randint(0, 255)
while set2g in gs:
set2g = r.randint(0, 255)
gs.append(set2g)
set2r = r.randint(0, 255)
while set2r in rs:
set2r = r.randint(0, 255)
rs.append(set2r)
set3b = r.randint(0, 255)
while set3b in bs:
set3b = r.randint(0, 255)
# bs.append(set3b)
set3g = r.randint(0, 255)
while set3g in gs:
set3g = r.randint(0, 255)
# gs.append(set3g)
set3r = r.randint(0, 255)
while set3r in rs:
set3r = r.randint(0, 255)
# rs.append(set3r)
return TEMPLATE.format(
x1=x1,
x2=x2,
set1b=set1b,
set1g=set1g,
set1r=set1r,
set2b=set2b,
set2g=set2g,
set2r=set2r,
set3b=set3b,
set3g=set3g,
set3r=set3r,
)