コード例 #1
0
    public int AggresiveMove(int playerID, GameMatrix gm)
    {
        int pWinCheck = PrimaryWinMove(playerID, gm);

        if (pWinCheck != 0)
        {
            return(pWinCheck);
        }

        int pBlockCheck = PrimaryBlockMove(playerID, gm);

        if (pBlockCheck != 0)
        {
            return(pBlockCheck);
        }

        int best     = 0;
        int bestmove = 0;

        for (int iii = 1; iii < 10; iii++)
        {
            if (gm.MoveLegal(iii))
            {
                int value = gm.calculateAttackScore(iii, playerID);
                if (value >= best)
                {
                    bestmove = iii;
                    best     = value;
                }
            }
        }
        return(bestmove);
    }