-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_full.py
83 lines (77 loc) · 1.59 KB
/
run_full.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
81
82
83
from game.game import Game
from evo.evo import EvoAlg
from agents.rulebased import RuleBasedAgent0, RuleBasedAgent1, RuleBasedAgent2, RuleBasedAgent3
import random
import random
import time
gen_param_specs = {
'initial_rock_density' : {
'dtype' : float,
'min' : 0.1,
'max' : 0.4
},
'initial_tree_density' : {
'dtype' : float,
'min' : 0.1,
'max' : 0.4
},
'rock_refinement_runs' : {
'dtype' : int,
'min' : 1,
'max' : 3
},
'tree_refinement_runs' : {
'dtype' : int,
'min' : 1,
'max' : 3
},
'rock_neighbour_depth' : {
'dtype' : int,
'min' : 1,
'max' : 2
},
'tree_neighbour_depth' : {
'dtype' : int,
'min' : 1,
'max' : 2
},
'rock_neighbour_number' : {
'dtype' : int,
'min' : 4,
'max' : 8
},
'tree_neighbour_number' : {
'dtype' : int,
'min' : 4,
'max' : 8
},
'base_clear_depth' : {
'dtype' : int,
'min' : 1,
'max' : 1
},
'enemies_crush_trees' : {
'dtype' : bool
},
'random_seed' : {
'dtype' : int,
'min' : 1,
'max' : 9999
},
'flee_distance' : {
'dtype' : int,
'min' : 0,
'max' : 10
}
}
random.seed(47)
ea = EvoAlg(gen_param_specs)
env = Game(evo_system=ea)
state = env.reset()
agent = RuleBasedAgent3(env)
while True:
state, _, done, _ = env.step(agent.act(state))
time.sleep(0.1)
if done:
env.reset()
agent = RuleBasedAgent3(env)