-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.py
77 lines (63 loc) · 4.26 KB
/
store.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
MAX_CUBES_STORED = 5
ZONE_0_STORE_LOCATION_0 = {'x': 0.5, 'y': 7.5, 'max_d_theta': 10}
ZONE_0_STORE_LOCATION_1 = {'x': 1, 'y': 7.5, 'max_d_theta': 10}
ZONE_0_STORE_LOCATION_2 = {'x': 0.5, 'y': 7, 'max_d_theta': 10}
ZONE_0_STORE_LOCATION_3 = {'x': 0.75, 'y': 7.25, 'max_d_theta': 10}
ZONE_0_STORE_LOCATION_4 = {'x': 0.75, 'y': 7.25, 'max_d_theta': 10}
ZONE_0_STORE_LOCATIONS = [ZONE_0_STORE_LOCATION_0, ZONE_0_STORE_LOCATION_1, ZONE_0_STORE_LOCATION_2, ZONE_0_STORE_LOCATION_3, ZONE_0_STORE_LOCATION_4]
ZONE_0_RETURN_LOCATION_012 = {'x': 1, 'y': 7}
ZONE_0_RETURN_LOCATION_34 = {'x': 1.5, 'y': 6.5}
ZONE_0_RETURN_LOCATIONS = [ZONE_0_RETURN_LOCATION_012, ZONE_0_RETURN_LOCATION_012, ZONE_0_RETURN_LOCATION_012, ZONE_0_RETURN_LOCATION_34, ZONE_0_RETURN_LOCATION_34]
ZONE_0_NEXT_CUBE_LOCATION = {'x': 2.5, 'y': 5.5}
ZONE_1_STORE_LOCATION_0 = {'x': 7.5, 'y': 7.5, 'max_d_theta': 10}
ZONE_1_STORE_LOCATION_1 = {'x': 7.5, 'y': 7, 'max_d_theta': 10}
ZONE_1_STORE_LOCATION_2 = {'x': 7, 'y': 7.5, 'max_d_theta': 10}
ZONE_1_STORE_LOCATION_3 = {'x': 7.25, 'y': 7.25, 'max_d_theta': 10}
ZONE_1_STORE_LOCATION_4 = {'x': 7.25, 'y': 7.25, 'max_d_theta': 10}
ZONE_1_STORE_LOCATIONS = [ZONE_1_STORE_LOCATION_0, ZONE_1_STORE_LOCATION_1, ZONE_1_STORE_LOCATION_2, ZONE_1_STORE_LOCATION_3, ZONE_1_STORE_LOCATION_4]
ZONE_1_RETURN_LOCATION_012 = {'x': 7, 'y': 7}
ZONE_1_RETURN_LOCATION_34 = {'x': 6.5, 'y': 6.5}
ZONE_1_RETURN_LOCATIONS = [ZONE_1_RETURN_LOCATION_012, ZONE_1_RETURN_LOCATION_012, ZONE_1_RETURN_LOCATION_012, ZONE_1_RETURN_LOCATION_34, ZONE_1_RETURN_LOCATION_34]
ZONE_1_NEXT_CUBE_LOCATION = {'x': 5.5, 'y': 5.5}
ZONE_2_STORE_LOCATION_0 = {'x': 7.5, 'y': 0.5, 'max_d_theta': 10}
ZONE_2_STORE_LOCATION_1 = {'x': 7, 'y': 0.5, 'max_d_theta': 10}
ZONE_2_STORE_LOCATION_2 = {'x': 7.5, 'y': 1, 'max_d_theta': 10}
ZONE_2_STORE_LOCATION_3 = {'x': 7.25, 'y': 0.75, 'max_d_theta': 10}
ZONE_2_STORE_LOCATION_4 = {'x': 7.25, 'y': 0.75, 'max_d_theta': 10}
ZONE_2_STORE_LOCATIONS = [ZONE_2_STORE_LOCATION_0, ZONE_2_STORE_LOCATION_1, ZONE_2_STORE_LOCATION_2, ZONE_2_STORE_LOCATION_3, ZONE_2_STORE_LOCATION_4]
ZONE_2_RETURN_LOCATION_012 = {'x': 7, 'y': 1}
ZONE_2_RETURN_LOCATION_34 = {'x': 6.5, 'y': 1.5}
ZONE_2_RETURN_LOCATIONS = [ZONE_2_RETURN_LOCATION_012, ZONE_2_RETURN_LOCATION_012, ZONE_2_RETURN_LOCATION_012, ZONE_2_RETURN_LOCATION_34, ZONE_2_RETURN_LOCATION_34]
ZONE_2_NEXT_CUBE_LOCATION = {'x': 5.5, 'y': 2.5}
ZONE_3_STORE_LOCATION_0 = {'x': 0.5, 'y': 0.5, 'max_d_theta': 10}
ZONE_3_STORE_LOCATION_1 = {'x': 0.5, 'y': 1, 'max_d_theta': 10}
ZONE_3_STORE_LOCATION_2 = {'x': 1, 'y': 0.5, 'max_d_theta': 10}
ZONE_3_STORE_LOCATION_3 = {'x': 0.75, 'y': 0.75, 'max_d_theta': 10}
ZONE_3_STORE_LOCATION_4 = {'x': 0.75, 'y': 0.75, 'max_d_theta': 10}
ZONE_3_STORE_LOCATIONS = [ZONE_3_STORE_LOCATION_0, ZONE_3_STORE_LOCATION_1, ZONE_3_STORE_LOCATION_2, ZONE_3_STORE_LOCATION_3, ZONE_3_STORE_LOCATION_4]
ZONE_3_RETURN_LOCATION_012 = {'x': 1, 'y': 1}
ZONE_3_RETURN_LOCATION_34 = {'x': 1.5, 'y': 1.5}
ZONE_3_RETURN_LOCATIONS = [ZONE_3_RETURN_LOCATION_012, ZONE_3_RETURN_LOCATION_012, ZONE_3_RETURN_LOCATION_012, ZONE_3_RETURN_LOCATION_34, ZONE_3_RETURN_LOCATION_34]
ZONE_3_NEXT_CUBE_LOCATION = {'x': 2.5, 'y': 2.5}
STORE_LOCATIONS = [ZONE_0_STORE_LOCATIONS, ZONE_1_STORE_LOCATIONS, ZONE_2_STORE_LOCATIONS, ZONE_3_STORE_LOCATIONS]
RETURN_LOCATIONS = [ZONE_0_RETURN_LOCATIONS, ZONE_1_RETURN_LOCATIONS, ZONE_2_RETURN_LOCATIONS, ZONE_3_RETURN_LOCATIONS]
NEXT_CUBE_LOCATIONS = [ZONE_0_NEXT_CUBE_LOCATION, ZONE_1_NEXT_CUBE_LOCATION, ZONE_2_NEXT_CUBE_LOCATION, ZONE_3_NEXT_CUBE_LOCATION]
class StoreManager():
def __init__(self, zone):
self.store_locations = STORE_LOCATIONS[zone]
self.return_locations = RETURN_LOCATIONS[zone]
self.next_cube_location = NEXT_CUBE_LOCATIONS[zone]
self.cubes_stored = 0
def getReturnLocation(self):
if (self.cubes_stored == MAX_CUBES_STORED):
return None
else:
return_location = self.return_locations[self.cubes_stored]
return return_location
def getStoreLocation(self):
if (self.cubes_stored == MAX_CUBES_STORED):
return None
else:
store_location = self.store_locations[self.cubes_stored]
self.cubes_stored += 1
return store_location