def declare_possible_actions(cls): from pygame.locals import K_SPACE, K_RIGHT, K_LEFT actions = super().declare_possible_actions() actions['SPACE'] = Action(K_SPACE) actions['SPACE_RIGHT'] = Action(K_SPACE, K_RIGHT) actions['SPACE_LEFT'] = Action(K_SPACE, K_LEFT) return actions
def declare_possible_actions(cls): from pygame.locals import K_UP, K_DOWN actions = {} actions["UP"] = Action(K_UP) actions["DOWN"] = Action(K_DOWN) actions["NO_OP"] = Action() return actions
def declare_possible_actions(cls): from pygame.locals import K_LEFT, K_RIGHT actions = {} actions["LEFT"] = Action(K_LEFT) actions["RIGHT"] = Action(K_RIGHT) actions["NO_OP"] = Action() return actions
def declare_possible_actions(cls): # TODO port from vgdl.core import Action from pygame.locals import K_RIGHT, K_SPACE actions = {} actions["RIGHT"] = Action(K_RIGHT) actions["SPACE"] = Action(K_SPACE) actions["NO_OP"] = Action() return actions
def declare_possible_actions(cls) -> Dict[str, Action]: """ Assume this does not change throughout the game. That is, we commit to the semantics that all actions are always possible, no matter whether they will actually have an effect or not. Composite actions (multiple keys) must be defined separately. It is important that a composite action is defined explicitly, as most RL agents work with enumerated actions instead of actions represented by multi-dimensional vectors (i.e. keypresses). """ from pygame.locals import K_LEFT, K_RIGHT, K_UP, K_DOWN actions = {} actions["UP"] = Action(K_UP) actions["DOWN"] = Action(K_DOWN) actions["LEFT"] = Action(K_LEFT) actions["RIGHT"] = Action(K_RIGHT) actions["NO_OP"] = Action() return actions
def declare_possible_actions(cls): from pygame.locals import K_SPACE actions = super().declare_possible_actions() actions["SPACE"] = Action(K_SPACE) return actions
from pygame.math import Vector2 from vgdl.core import Action, Color GREEN = Color((0, 200, 0)) BLUE = Color((0, 0, 200)) RED = Color((200, 0, 0)) GRAY = Color((90, 90, 90)) WHITE = Color((250, 250, 250)) BROWN = Color((140, 120, 100)) BLACK = Color((0, 0, 0)) ORANGE = Color((250, 160, 0)) YELLOW = Color((250, 250, 0)) PINK = Color((250, 200, 200)) GOLD = Color((250, 212, 0)) LIGHTRED = Color((250, 50, 50)) LIGHTORANGE = Color((250, 200, 100)) LIGHTBLUE = Color((50, 100, 250)) LIGHTGREEN = Color((50, 250, 50)) LIGHTGRAY = Color((150, 150, 150)) DARKGRAY = Color((30, 30, 30)) DARKBLUE = Color((20, 20, 100)) UP = Vector2(0, -1) DOWN = Vector2(0, 1) LEFT = Vector2(-1, 0) RIGHT = Vector2(1, 0) BASEDIRS = [UP, LEFT, DOWN, RIGHT] NOOP = Action()