Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gameSpec(self=0, enemy=1, swap=False):
players = [self, enemy]
if swap:
players.reverse()
return [
('players', ArrayConv(playerConv, players)),
('stage', DiscreteConv(32)),
]
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)),
]
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)),
]
playerConv = StructConv(player_spec)
def gameSpec(self=0, enemy=1, swap=False):
players = [self, enemy]
if swap:
players.reverse()
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)),
]
playerConv = StructConv(player_spec)