Python pygame.K_9 Examples

The following are 2 code examples of pygame.K_9(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pygame , or try the search function .
Example #1
Source File: environment.py    From Python-Reinforcement-Learning-Projects with MIT License 6 votes vote down vote up
def new_demo(test=True):
    import pygame
    from demo.game import Game
    
    if test is False:
        game = Game(640, 480, None)
    else:
        def _render(game):
            while True:
                game.draw()
                for event in pygame.event.get():
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_9:
                            game.increase_fps()
                        elif event.key == pygame.K_0:
                            game.decrease_fps()    
        pygame.init()
        DISPLAYSURF = pygame.display.set_mode((640, 480), 0, 32)
        pygame.display.set_caption('Demo')
        game = Game(640, 480, DISPLAYSURF)
        t = Thread(target=lambda: _render(game))
        t.start()
    
    return game 
Example #2
Source File: environment.py    From Python-Reinforcement-Learning-Projects with MIT License 5 votes vote down vote up
def new_demo(test=False):
    
    import pygame
    from demo.game import Game
    if test is False:
        game = Game(640, 480, None)
    else:
        def _render(game):
            while True:
                game.draw()
                for event in pygame.event.get():
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_9:
                            game.increase_fps()
                        elif event.key == pygame.K_0:
                            game.decrease_fps()    
        pygame.init()
        DISPLAYSURF = pygame.display.set_mode((640, 480), 0, 32)
        pygame.display.set_caption('Demo')
        game = Game(640, 480, DISPLAYSURF)
        t = Thread(target=lambda: _render(game))
        t.start()
    
    parameter = Parameter(lr=1e-3)
    parameter.gamma = 0.9
    parameter.iteration_num = 300000
    parameter.num_history_frames = 1
    parameter.network_type = 'mlp'
    
    parameter.update_method = 'rmsprop'
    parameter.rho = 0.95
    parameter.async_update_interval = 5
    parameter.input_scale = 1.0
    
    return game, parameter