-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.py
32 lines (27 loc) · 889 Bytes
/
routes.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
import random
import numpy as np
def generate_random_route(width, heigth, holes_count, min_distance=120):
route = []
zone_height = min_distance // 2
zones_count = heigth // zone_height
holes_per_zone = holes_count // zones_count
for i in range(zones_count):
for j in range(holes_per_zone):
x = random.randint(0, width)
y = random.randint(zone_height * i, zone_height * (i + 1))
route.append((x, y, 0))
return np.array(route)
def generate_simple_route(width, heigth, step=50):
route = []
c = 0
for i in range(heigth // step):
y = step // 2 + i * step
if y > heigth:
break
for j in range(width // step):
x = step // 2 + j * step
route.append((x, y, 0))
c += 5
if x > width:
break
return np.array(route)