Ejemplo n.º 1
0
class TestGui(TestCase):
    def setUp(self):
        self.gui = Gui(25, 25)
        self.assertEqual(self.gui.rows, 25)
        self.assertEqual(self.gui.cols, 25)

    def test_draw(self):
        self.gui.draw()

    def test_g_update(self):
        self.gui.g_update()

    def test_start(self):
        self.gui.start()

    def test_pause(self):
        self.gui.pause()
Ejemplo n.º 2
0
model.train(gameController.getTrainingHistory())

board = Board()
myGui = Gui(board)

redBot = Player(redVal, strategy='model', model=model)
yellow = Player(yellowVal, strategy='picked')
myController = GameController(board, redBot, yellow)
playerToMove = redBot

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()
    myGui.draw()

    if board.findState() == gameStateNotEnded:

        legalMoves = board.getLegalMoves()
        move = playerToMove.getMove(legalMoves, board.getBoard(), myGui)

        print(move)
        board.move(move, playerToMove.getPlayer())
        print("past move")
        myGui.draw()

        if playerToMove == redBot:
            playerToMove = yellow
        else:
            playerToMove = redBot