How to use the openai.RealConv function in openai

To help you get started, we’ve selected a few openai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vladfi1 / phillip / openai.py View on Github external
def __init__(self, conv, permutation):
    self.conv = conv
    self.permutation = permutation
    
    self.space = spaces.Tuple([conv.space for _ in permutation])
  
  def __call__(self, array):
    return [self.conv(array[i]) for i in self.permutation]

maxCharacter = 32 # should be large enough?

maxAction = 0x017E
numActions = 1 + maxAction

frameConv = RealConv(0, 100)
speedConv = RealConv(-10, 10) # generally around 0

player_spec = [
  ('percent', RealConv(0, 200)),
  ('facing', RealConv(-1, 1)),
  ('x', RealConv(-100, 100)),
  ('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
github vladfi1 / phillip / openai.py View on Github external
('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
  ('speed_ground_x_self', speedConv),
  ('speed_y_self', speedConv),
  ('speed_x_attack', speedConv),
  ('speed_y_attack', speedConv),
  ('shield_size', RealConv(0, 1)),
]

playerConv = StructConv(player_spec)

def gameSpec(self=0, enemy=1, swap=False):
  players = [self, enemy]
  if swap:
    players.reverse()
  
  return [
    ('players', ArrayConv(playerConv, players)),
    ('stage', DiscreteConv(32)),
  ]

game_spec = gameSpec()
gameConv = StructConv(game_spec)
github vladfi1 / phillip / openai.py View on Github external
self.space = spaces.Tuple([conv.space for _ in permutation])
  
  def __call__(self, array):
    return [self.conv(array[i]) for i in self.permutation]

maxCharacter = 32 # should be large enough?

maxAction = 0x017E
numActions = 1 + maxAction

frameConv = RealConv(0, 100)
speedConv = RealConv(-10, 10) # generally around 0

player_spec = [
  ('percent', RealConv(0, 200)),
  ('facing', RealConv(-1, 1)),
  ('x', RealConv(-100, 100)),
  ('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
  ('speed_ground_x_self', speedConv),
  ('speed_y_self', speedConv),
  ('speed_x_attack', speedConv),
  ('speed_y_attack', speedConv),
github vladfi1 / phillip / openai.py View on Github external
def __call__(self, array):
    return [self.conv(array[i]) for i in self.permutation]

maxCharacter = 32 # should be large enough?

maxAction = 0x017E
numActions = 1 + maxAction

frameConv = RealConv(0, 100)
speedConv = RealConv(-10, 10) # generally around 0

player_spec = [
  ('percent', RealConv(0, 200)),
  ('facing', RealConv(-1, 1)),
  ('x', RealConv(-100, 100)),
  ('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
  ('speed_ground_x_self', speedConv),
  ('speed_y_self', speedConv),
  ('speed_x_attack', speedConv),
  ('speed_y_attack', speedConv),
  ('shield_size', RealConv(0, 1)),
github vladfi1 / phillip / openai.py View on Github external
self.space = spaces.Tuple([conv.space for _ in permutation])
  
  def __call__(self, array):
    return [self.conv(array[i]) for i in self.permutation]

maxCharacter = 32 # should be large enough?

maxAction = 0x017E
numActions = 1 + maxAction

frameConv = RealConv(0, 100)
speedConv = RealConv(-10, 10) # generally around 0

player_spec = [
  ('percent', RealConv(0, 200)),
  ('facing', RealConv(-1, 1)),
  ('x', RealConv(-100, 100)),
  ('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),
  ('speed_air_x_self', speedConv),
  ('speed_ground_x_self', speedConv),
  ('speed_y_self', speedConv),
  ('speed_x_attack', speedConv),
github vladfi1 / phillip / openai.py View on Github external
class ArrayConv:
  def __init__(self, conv, permutation):
    self.conv = conv
    self.permutation = permutation
    
    self.space = spaces.Tuple([conv.space for _ in permutation])
  
  def __call__(self, array):
    return [self.conv(array[i]) for i in self.permutation]

maxCharacter = 32 # should be large enough?

maxAction = 0x017E
numActions = 1 + maxAction

frameConv = RealConv(0, 100)
speedConv = RealConv(-10, 10) # generally around 0

player_spec = [
  ('percent', RealConv(0, 200)),
  ('facing', RealConv(-1, 1)),
  ('x', RealConv(-100, 100)),
  ('y', RealConv(-100, 100)),
  ('action_state', DiscreteConv(numActions, 'action_state')),
  ('action_frame', frameConv),
  ('character', DiscreteConv(maxCharacter, 'character')),
  ('invulnerable', boolConv),
  ('hitlag_frames_left', frameConv),
  ('hitstun_frames_left', frameConv),
  ('jumps_used', DiscreteConv(8, 'jumps_used')),
  ('charging_smash', boolConv),
  ('in_air', boolConv),