Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bcollazo committed Dec 9, 2023
1 parent a63bae5 commit 8890002
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions catanatron_gym/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Make your training loop, ensuring to respect `env.get_valid_actions()`.
import random
import gymnasium as gym

env = gym.make("catanatron_gym:catanatron-v0")
env = gym.make("catanatron_gym:catanatron-v1")
observation, info = env.reset()
for _ in range(1000):
action = random.choice(env.get_valid_actions()) # your agent here (this takes random actions)

observation, reward, done, info = env.step(action)
# your agent here (this takes random actions)
action = random.choice(env.unwrapped.get_valid_actions())
observation, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
if done:
observation, info = env.reset()
env.close()
Expand Down Expand Up @@ -49,7 +50,7 @@ def mask_fn(env) -> np.ndarray:


# Init Environment and Model
env = gym.make("catanatron_gym:catanatron-v0")
env = gym.make("catanatron_gym:catanatron-v1")
env = ActionMasker(env, mask_fn) # Wrap to enable masking
model = MaskablePPO(MaskableActorCriticPolicy, env, verbose=1)

Expand Down Expand Up @@ -78,7 +79,7 @@ def my_reward_function(game, p0_color):

# 3-player catan on a "Mini" map (7 tiles) until 6 points.
env = gym.make(
"catanatron_gym:catanatron-v0",
"catanatron_gym:catanatron-v1",
config={
"map_type": "MINI",
"vps_to_win": 6,
Expand Down

1 comment on commit 8890002

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance Alert

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 8890002 Previous: 07c1ee2 Ratio
tests/integration_tests/test_speed.py::test_alphabeta_speed 0.8235323675676999 iter/sec (stddev: 1.2312439400605149) 1.1703865885612388 iter/sec (stddev: 1.3253603121468924) 1.42

This comment was automatically generated by workflow.

Please sign in to comment.