class_docstr: Holds the state of a player of DoubleOSeven
class_docstr_tok: ["Holds","the","state","of","a","player","of","DoubleOSeven"]
docstr: Update the current state with an authorized action.
docstr_tok: ["Update","the","current","state","with","an","authorized","action","."]
code: def update_with_action(self, action: str) -> None:
      """Update the current state with an authorized action."""
      if action not in self.actions:
          raise ValueError(
              f"Unauthorized action {action}, authorized are {self.actions}"
          )
      if action == "fire":
          if not self.ammunitions:
              raise ValueError("Cannot fire without amunitions")
          self.ammunitions -= 1
      elif action == "reload":
          self.ammunitions += 1
      if action == "protect":
          self.consecutive_protect += 1
      else:
          self.consecutive_protect = 0
  
file_path: nevergrad/nevergrad/functions/rl/envs.py
imports: import typing
  import numpy
  import gym
  from .None import base
label_desc: Use image node_id 2 for calling the JamesBond obj's underlying member method code with example usage: obj.update_with_action(action) without return types