pantheonrl.envs.rpsgym.rps.RPSWeightedAgent

class RPSWeightedAgent(r=1, p=1, s=1, np_random=<module 'numpy.random' from '/opt/homebrew/Caskroom/miniforge/base/envs/PantheonRL_dev/lib/python3.10/site-packages/numpy/random/__init__.py'>)[source]

Bases: Agent

Random RPS agent based on weights of each action.

Methods

get_action

Return an action given an observation.

update

Add new rewards and done information if the agent can learn.

get_action(obs)[source]

Return an action given an observation.

Parameters:

obs – The observation to use

Returns:

The action to take

update(reward, done)[source]

Add new rewards and done information if the agent can learn.

Each update corresponds to the most recent get_action.

If there are multiple calls to update that correspond to the same get_action, their rewards are summed up and the last done flag will be used.

Parameters:
  • reward – The reward receieved from the previous action step

  • done – Whether the game is done