コード例 #1
0
ファイル: gridworldgui.py プロジェクト: rocknrolla/gridworld
    def move(self, a):

        (previous, a, reward, current) = Gridworld.move(self, a)

        if self.updategui:
            self.state2circle(current)


        return (previous, a, reward, current)
コード例 #2
0
ファイル: gridworldgui.py プロジェクト: rocknrolla/gridworld
    def __init__(self, *args, **kwargs):
        # initialize the base gridworld class (no gui)
        Gridworld.__init__(self, *args, **kwargs)

        nrows = 5
        ncols = 5
        size = 32
        # compute the appropriate height and width (with room for cell borders)
        self.height = nrows * size + nrows + 1
        self.width = ncols * size + ncols + 1
        self.size = size

        # initialize pygame ( SDL extensions )
        pygame.init()
        pygame.display.set_mode((self.width, self.height))
        pygame.display.set_caption('Gridworld')
        self.screen = pygame.display.get_surface()
        self.surface = pygame.Surface(self.screen.get_size())

        self.background()
        self.screen.blit(self.surface, (0,0))
        pygame.display.flip()

        self.updategui = True # switch to stop updating gui if you want to collect a trace quickly