Ejemplo n.º 1
0
        private GridTilingService(Grid grid, DifficultyEnum difficulty)
        {
            _grid       = grid.Clone();
            _difficulty = difficulty;

            _tiles = AvailableTileTypes.ConvertAll(tile => new TileData
            {
                Tile            = tile,
                AvailablePoints = grid.GetAvailablePoints(tile)
            });


            int hardMinimumFreePoints = GetHardMinimumFreePoints();
            int normalMinimumFreePointsByPercentage =
                (int)Math.Round((double)(100 * NormalDifficultyPointsPercentage) / _grid.FreePointsCount);

            _freePointsByDifficulty = new Difficulties
            {
                { DifficultyEnum.Hard, hardMinimumFreePoints },
                { DifficultyEnum.Normal, Math.Max(hardMinimumFreePoints + 2, normalMinimumFreePointsByPercentage) }
            };

            Log($"Difficulties: hard - {_freePointsByDifficulty[DifficultyEnum.Hard]}, normal - {_freePointsByDifficulty[DifficultyEnum.Normal]}");
        }
Ejemplo n.º 2
0
 public static List <Tile> GetTilesForGrid(Grid grid, DifficultyEnum difficulty)
 {
     return((new GridTilingService(grid.Clone(), difficulty)).GetTiles());
 }