-
Notifications
You must be signed in to change notification settings - Fork 0
/
hw8_part11.py
32 lines (25 loc) · 954 Bytes
/
hw8_part11.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 json
from BerryField import BerryField
from Bear import Bear
from Tourist import Tourist
if __name__ == '__main__':
#simulation = 'bears_and_berries_1.json'
simulation = input('Enter the json file name for the simulation => ')
print(simulation)
f = open(simulation)
data = json.loads(f.read())
active_bears = []
for d in data['active_bears']:
active_bears.append(Bear(d[0], d[1], d[2], True))
reserve_bears = []
for d in data['reserve_bears']:
reserve_bears.append(Bear(d[0], d[1], d[2], False))
active_tourists = []
for d in data['active_tourists']:
active_tourists.append(Tourist(d[0], d[1]))
reserve_tourists = []
for d in data['reserve_tourists']:
reserve_tourists.append(Tourist(d[0], d[1]))
berry_field = BerryField(data['berry_field'], active_bears, reserve_bears, active_tourists, reserve_tourists)
f.close()
print(berry_field)