class_docstr: Play the move that would beat the last move of the opponent.
class_docstr_tok: ["Play","the","move","that","would","beat","the","last","move","of","the","opponent","."]
code: def compute_actions(
      self,
      obs_batch,
      state_batches=None,
      prev_action_batch=None,
      prev_reward_batch=None,
      info_batch=None,
      episodes=None,
      **kwargs,
  ):
      def successor(x):
          # Make this also work w/o one-hot preprocessing.
          if isinstance(self.observation_space, gym.spaces.Discrete):
              if x == ROCK:
                  return PAPER
              elif x == PAPER:
                  return SCISSORS
              elif x == SCISSORS:
                  return ROCK
              else:
                  return random.choice([ROCK, PAPER, SCISSORS])
          # One-hot (auto-preprocessed) inputs.
          else:
              if x[ROCK] == 1:
                  return PAPER
              elif x[PAPER] == 1:
                  return SCISSORS
              elif x[SCISSORS] == 1:
                  return ROCK
              elif x[-1] == 1:
                  return random.choice([ROCK, PAPER, SCISSORS])
  
      return [successor(x) for x in obs_batch], [], {}
  
file_path: ray/rllib/examples/policy/rock_paper_scissors_dummies.py
imports: import gymnasium
  import numpy
  import random
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.view_requirement import ViewRequirement
label_desc: Use image node_id 2 for calling the BeatLastHeuristic obj's underlying member method code with example usage: obj.compute_actions(obs_batch, state_batches, prev_action_batch, prev_reward_batch, info_batch, episodes) and returns: unknown,  list,  dict, PAPER, PAPER, SCISSORS, SCISSORS, ROCK, random, ROCK, random