Esempio n. 1
0
    def test_actionValid(self):
        game = AzulGame(False)
        board = AzulBoard()
        #board.display()

        for i in range(180):
            action = board.decodeAction(1, i)
            #print(i, action.toString(), board.isActionValid(action))
        
        self.assertEqual(1, 1)
Esempio n. 2
0
from azul.AzulPlayers import HumanAzulPlayer, RandomPlayer
from azul.pytorch.NNet import NNetWrapper as NNet
from azul.AzulArena import AzulArena

import cProfile, pstats, io
from pstats import SortKey

import numpy as np
from utils import *
import sqlite3
from datetime import datetime
"""
use this script to play any two agents against each other, or play manually with
any agent.
"""
g = AzulGame(shouldRandomize=False)

# all players
n1 = NNet(g)
n2 = NNet(g)

n1.load_checkpoint('./temp/', 'best.pth.tar')
n2.load_checkpoint('./temp/', 'best.pth.tar')

args = dotdict({'numMCTSSims': 50, 'cpuct': 1.0})
mcts = MCTS(g, n1, args)
mcts2 = MCTS(g, n2, args)
n1p = lambda x: np.argmax(mcts.getActionProb(x, temp=0))
n2p = lambda x: np.argmax(mcts2.getActionProb(x, temp=0))

player1 = n1p
Esempio n. 3
0
 def test_board(self):
     game = AzulGame(False)
     board = AzulBoard()
     self.assertEqual(board.player1.floorLine.tileCollection.getCount(), 0)
Esempio n. 4
0
 def test_decodeAction(self):
     game = AzulGame(False)
     board = AzulBoard()