Example #1
0
    // Evaluation function for alpha-beta pruning / minimax
    private static float EvaluateMove(GameState gs)
    {
        if (gs.IsMyWin()) {
        return MAX_MAP_SIZE;
        }

        if (gs.IsOpponentWin()) {
        return -MAX_MAP_SIZE;
        }

        if (gs.IsDraw()) {
        //		return 0
        }

        Territory room = new Territory(gs);
        room.DetermineTerritories();

        int mySize = room.GetMySize();
        int opponentSize = room.GetOpponentSize();
        int size = room.GetMySize() - room.GetOpponentSize();
        //Console.Error.WriteLine(String.Format("my room:{0} other room:{1}",mySize,opponentSize));

        return (float)size;
    }