示例#1
0
    public override float scoreMap(AIMapInfo aiMapInfo)
    {
        int currentEnemyCount = 0;
        int currentEnemyKingCount = 0;
        int enemyTiles = 0;
        int friendlyTiles = 0;
        float mapScore = 0;
        for (int x = 0; x < MapGenerator.BoardWidth; x++)
        {
            for (int y = 0; y < MapGenerator.BoardHeight; y++)
            {
                Tile tileAtPoint = MapGenerator.getTileAtPoint(x, y);
                if (tileAtPoint.getCurrentEntity() != null && aiMapInfo.checkEntityIsEnemy(tileAtPoint.getCurrentEntity()))
                {
                    if (tileAtPoint.getCurrentEntity() is King)
                    {
                        currentEnemyKingCount++;
                    }
                    currentEnemyCount++;
                }
                if (tileAtPoint.currentTileType == Tile.JANITOR)
                {
                    enemyTiles++;
                }
                if (tileAtPoint.currentTileType == Tile.DEMON)
                {
                    friendlyTiles++;
                }
            }
        }
        if (currentEnemyKingCount <= 0)
        {
            mapScore += 100000;
        }

        mapScore += (5 * (friendlyTiles - aiMapInfo.tilesControlled));
        mapScore += (5 * (aiMapInfo.enemyTilesControlled - enemyTiles));
        mapScore += 30 * (aiMapInfo.getAllEnemyEntities().Count - currentEnemyCount);
        mapScore += scorePosition(aiMapInfo);
        return mapScore;
    }