Skip to content

Commit

Permalink
Update parallel_rps.py
Browse files Browse the repository at this point in the history
correct type and update name to be less confusing
  • Loading branch information
dm-ackerman authored Jan 26, 2024
1 parent 3e46b60 commit 9717da9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/code_examples/parallel_rps.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ROCK = 0
PAPER = 1
SCISSORS = 2
NONE = 3
NO_MOVE = 3
MOVES = ["ROCK", "PAPER", "SCISSORS", "None"]
NUM_ITERS = 100
REWARD_MAP = {
Expand Down Expand Up @@ -131,7 +131,7 @@ def reset(self, seed=None, options=None):
self.agents = self.possible_agents[:]
self.num_moves = 0
# the observations should be numpy arrays even if there is only one value
observations = {agent: np.array(NONE) for agent in self.agents}
observations = {agent: np.array(NO_MOVE) for agent in self.agents}
infos = {agent: {} for agent in self.agents}
self.state = observations

Expand Down Expand Up @@ -168,7 +168,7 @@ def step(self, actions):
# This is converted to a numpy value of type int to match the type
# that we declared in observation_space()
observations = {
self.agents[i]: np.array(actions[self.agents[1 - i]], dtype=np.int_)
self.agents[i]: np.array(actions[self.agents[1 - i]], dtype=np.int64)
for i in range(len(self.agents))
}
self.state = observations
Expand Down

0 comments on commit 9717da9

Please sign in to comment.