コード例 #1
0
        /// <summary>
        /// Calculate the percentage complete for a map
        /// </summary>
        /// <param name="Map"></param>
        /// <returns>1 = 1%</returns>
        public static int PercentageComplete(SokobanMap Map)
        {
            int crategoals = Map.Count(CellStates.FloorGoalCrate);
            int goals = Map.Count(Cell.Goal);

            if (goals == 0) return 0;

            // This is not 100% correct, as some goal positiona may not be needed
            return (crategoals*100)/goals;
        }
コード例 #2
0
        /// <summary>
        /// Calculate an automated Rating map
        /// </summary>
        /// <param name="Map">Sokoban Map (Initial condition)</param>
        /// <returns></returns>
        public static double CalcRating(SokobanMap Map)
        {
            double result = 0;
            result += Map.Count(Cell.Crate) * 1.0;
            result += Map.Count(CellStates.Floor) * 0.11;

            if (PercentageComplete(Map) > 50)
            {
                // Counter-intuitive map
                result *= 1.15;
            }
            return result;
        }
コード例 #3
0
ファイル: BoxPathFinder.cs プロジェクト: UserNT/SokobanSolver
 public BoxPathFinder(SokobanMap map)
     : base()
 {
     this.map = map;
 }
コード例 #4
0
 public KeeperPathFinder(SokobanMap map)
     : base()
 {
     this.map = map;
 }
コード例 #5
0
 /// <summary>
 /// Calculate the percentage complete for a map
 /// </summary>
 /// <param name="Map"></param>
 /// <returns>1 = 1%</returns>
 public static int PercentageComplete(SokobanMap Map)
 {
     // This is not 100% correct, as some goal positiona may not be needed
     return (Map.Count(CellStates.FloorGoalCrate)*100)/(Map.Count(Cell.Goal));
 }
コード例 #6
0
 /// <summary>
 /// Calculate an automated Rating map
 /// </summary>
 /// <param name="Map"></param>
 /// <returns></returns>
 public static double CalcRating(SokobanMap Map)
 {
     return (double)Map.Count(Cell.Goal) / (double)Map.Count(Cell.Floor) * 1000;
 }