Skip to content

Commit 76a1d8e

Browse files
authored
Fix the docs for gym microrts (#211)
* This PR fixes the docs for gym microrts * Update black version
1 parent 69d9ac4 commit 76a1d8e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- --remove-unused-variables
2525
- --remove-all-unused-imports
2626
- repo: https://github.com/python/black
27-
rev: 21.12b0
27+
rev: 22.3.0
2828
hooks:
2929
- id: black
3030
args:

enn_zoo/enn_zoo/codecraft/cc_vec_env.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ def rules(self) -> Rules:
447447
# )
448448
# else:
449449
return Rules(
450-
mothership_damage_multiplier=2 ** self.config.mothership_damage_scale,
450+
mothership_damage_multiplier=2**self.config.mothership_damage_scale,
451451
cost_modifiers={build: 1.0 for build in self.objective.builds()},
452452
)
453453

@@ -679,7 +679,7 @@ def observe(self, obs_filter: ObsSpace) -> VecObs:
679679
start = stride * i + obs_config.endglobals()
680680
x = obs[start]
681681
y = obs[start + 1]
682-
score = -math.sqrt(x ** 2 + y ** 2) / 1000.0
682+
score = -math.sqrt(x**2 + y**2) / 1000.0
683683
elif self.objective == Objective.DISTANCE_TO_CRYSTAL:
684684
dstart = stride * i + obs_config.endglobals()
685685
xd = obs[dstart]
@@ -691,7 +691,7 @@ def observe(self, obs_filter: ObsSpace) -> VecObs:
691691
x = obs[mstart] - xd
692692
y = obs[mstart + 1] - yd
693693
size = obs[mstart + 2]
694-
nearness = 0.5 - math.sqrt(x ** 2 + y ** 2) / 1000.0
694+
nearness = 0.5 - math.sqrt(x**2 + y**2) / 1000.0
695695
score = max(score, 0.2 * nearness * size)
696696
elif self.objective in [Objective.DISTANCE_TO_1000_500]:
697697

enn_zoo/enn_zoo/microrts/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,46 @@ Prerequisites:
1010
Run an experiment locally
1111

1212
```bash
13-
poetry run python enn_ppo/enn_ppo/train.py \
13+
poetry run python enn_zoo/enn_zoo/train.py \
1414
env.id=GymMicrorts \
15-
env.num_envs=4 \
15+
rollout.num_envs=4 \
1616
total_timesteps=100000 \
17-
env.num_steps=256
17+
rollout.steps=256
1818
```
1919

2020
Run a different map. See [here](https://github.com/vwxyzjn/microrts/tree/master/maps/16x16) for a full list of maps.
2121
```bash
22-
poetry run python enn_ppo/enn_ppo/train.py \
22+
poetry run python enn_zoo/enn_zoo/train.py \
2323
env.id=GymMicrorts \
24-
env.num_envs=4 \
24+
rollout.num_envs=4 \
2525
total_timesteps=100000 \
26-
env.num_steps=256 \
26+
rollout.steps=256 \
2727
env.kwargs="{\"map_path\": \"maps/16x16/basesWorkers16x16.xml\"}"
2828
```
2929

3030

3131
Run a tracked experiment
3232

3333
```bash
34-
poetry run python enn_ppo/enn_ppo/train.py \
34+
poetry run python enn_zoo/enn_zoo/train.py \
3535
env.id=GymMicrorts \
36-
env.num_envs=24 \
36+
rollout.num_envs=24 \
3737
total_timesteps=100000 \
38-
env.num_steps=256 \
38+
rollout.steps=256 \
3939
track=true
4040
```
4141

4242
Run a tracked experiment with video tracking
4343

4444
```
45-
poetry run python enn_ppo/enn_ppo/train.py \
45+
poetry run python enn_zoo/enn_zoo/train.py \
4646
env.id=GymMicrorts \
47-
env.num_envs=1 \
47+
rollout.num_envs=1 \
4848
total_timesteps=10000 \
49-
env.num_steps=256 \
49+
rollout.steps=256 \
5050
eval.capture_videos=true \
5151
eval.steps=500 \
52-
eval.num_envs=1 \
52+
rollout.num_envs=1 \
5353
eval.interval=10000 \
5454
track=true
5555
```

entity_gym/entity_gym/examples/move_to_origin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def observe(self, done: bool = False) -> Observation:
138138
"horizontal_thruster": CategoricalActionMask(),
139139
"vertical_thruster": CategoricalActionMask(),
140140
},
141-
reward=(self.last_x_pos ** 2 + self.last_y_pos ** 2) ** 0.5
142-
- (self.x_pos ** 2 + self.y_pos ** 2) ** 0.5,
141+
reward=(self.last_x_pos**2 + self.last_y_pos**2) ** 0.5
142+
- (self.x_pos**2 + self.y_pos**2) ** 0.5,
143143
done=done,
144144
)

0 commit comments

Comments
 (0)