class_docstr: Wrap a gym-retro environment and make it use discrete
  actions for the Sonic game.
class_docstr_tok: ["Wrap","a","gym-retro","environment","and","make","it","use","discrete","actions","for","the","Sonic","game","."]
code: def __init__(self, env):
      super(SonicDiscretizer, self).__init__(env)
      buttons = [
          "B",
          "A",
          "MODE",
          "START",
          "UP",
          "DOWN",
          "LEFT",
          "RIGHT",
          "C",
          "Y",
          "X",
          "Z",
      ]
      actions = [
          ["LEFT"],
          ["RIGHT"],
          ["LEFT", "DOWN"],
          ["RIGHT", "DOWN"],
          ["DOWN"],
          ["DOWN", "B"],
          ["B"],
      ]
      self._actions = []
      for action in actions:
          arr = np.array([False] * 12)
          for button in action:
              arr[buttons.index(button)] = True
          self._actions.append(arr)
      self.action_space = gym.spaces.Discrete(len(self._actions))
  
imports: from collections import deque
  import cv2
  from .atari_wrappers import WarpFrame, ClipRewardEnv, FrameStack, ScaledFloatFrame
  from .wrappers import TimeLimit
  import numpy
  import gym
label_desc: Use image node_id 1 to create a new SonicDiscretizer object from inherited base classes: gym with example: obj = SonicDiscretizer(env)