-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgen.py
More file actions
31 lines (29 loc) · 720 Bytes
/
Copy pathgen.py
File metadata and controls
31 lines (29 loc) · 720 Bytes
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
import random
def sanity(b, balls):
for (x1, y1, r1) in balls:
if (b[0] - x1)**2 + (b[1] - y1)**2 < (b[2] + r1)**2:
return False
return True
R = 1
N = 10000
L = 10000
W = 10000
M = 2000
print(f"{R} {N}")
for i in range(N):
print(str(random.randint(1, 1)) + " ", end='')
print()
print(f"{L} {W} {M}")
balls = []
for i in range(M):
while True:
x = random.randint(0, L)
y = random.randint(0, W)
if min(min(y, W-y), min(x, L-x)) // 10 < 1: continue
r = random.randint(1, min(min(y, W-y), min(x, L-x)) // 10)
b = [x,y,r]
if sanity(b, balls):
balls.append(b)
break
for b in balls:
print(f"{b[0]} {b[1]} {b[2]}")