Beispiel #1
0
import pyglet
from pyglet.window import key
from model.agent import Agent
from game.view import View
import numpy as np
import sys

# define constants
_width, _height = 300, 400


if __name__ == '__main__':
    _screen = View(_width, _height, 'Tetris')
    _board = _screen._board

    if len(sys.argv) == 1:
        _agent = Agent()
        _agent.run(_board)
    else:
        model = sys.argv[1]
        _screen.use_trained_agent(model)


    pyglet.app.run()
Beispiel #2
0
import pyglet
from model.agent import Agent
from game.view import View
import sys

# define constants
WIDTH, HEIGHT = 300, 400

if __name__ == '__main__':
    screen = View(WIDTH, HEIGHT, 'Tetris')
    board = screen.board

    if len(sys.argv) == 2:
        if sys.argv[1] == 'train':
            _agent = Agent()
            _agent.run(board)
    elif len(sys.argv) >= 3:
        model = sys.argv[2]
        if sys.argv[1] == 'play':
            screen.use_trained_agent(model)
        if sys.argv[1] == 'train':
            _agent = Agent(model_num=model)
            _agent.run(board)

    pyglet.app.run()