コード例 #1
0
    void Start()
    {
        return;

        Debug.Log("---");
        Game g = new Game(4, 4);

        g.winCondition  = new InARowCondition(Direction.LINE, 3);
        g.loseCondition = new InARowCondition(Direction.LINE, 2);
        MCTSAgent p = new MCTSAgent(1);
        MCTSAgent q = new MCTSAgent(2);

        g.PrintBoard();
        for (int i = 0; i < 5; i++)
        {
            p.TakeTurn(g);
            g.PrintBoard();
            if (g.endStatus > 0)
            {
                break;
            }
            q.TakeTurn(g);
            g.PrintBoard();
            if (g.endStatus > 0)
            {
                break;
            }
        }
        Debug.Log(g.endStatus);
        Debug.Log("---");
    }
コード例 #2
0
    IEnumerator PauseForOpponent()
    {
        allowInteraction = false;

        //Wait briefly for the AI to take their turn
        //Brendon Chung tweeted this lovely breakdown of the perception of time
        //as like a rule of thumb, and it's stuck with me - it's easy to overestimate
        //https://twitter.com/BlendoGames/status/1105587512297185280
        yield return(new WaitForSeconds(0.3f));

        npcPlayer.TakeTurn(currentGame, TimeAllottedPerTurn);
        if (currentGame.endStatus != 0)
        {
            SetEndState();
        }

        allowInteraction = true;
    }