public static IBitmap FindDoors(StaticAnalysisMaps staticMaps) { var res = new Bitmap(staticMaps.FloorMap.Size); foreach (var floor in staticMaps.FloorMap.TruePositions()) { if (staticMaps.CornerMap[floor]) { continue; // Corners cannot be doors } // #.# if (staticMaps.WallMap[floor + VectorInt2.Left] && staticMaps.WallMap[floor + VectorInt2.Right]) { res[floor] = true; } // # // . // # if (staticMaps.WallMap[floor + VectorInt2.Up] && staticMaps.WallMap[floor + VectorInt2.Down]) { res[floor] = true; } } return(res); }
public static IBitmap FindDeadMap(StaticAnalysisMaps staticMaps) { var dead = new Bitmap(staticMaps.FloorMap.Size); // All corners are dead (provided no goals) foreach (var corner in staticMaps.CornerMap.TruePositions()) { if (!staticMaps.GoalMap[corner]) { dead[corner] = true; } } // All recesses are dead (provided no goals) foreach (var recess in staticMaps.RecessMaps) { if (!recess.Intersects(staticMaps.GoalMap)) { foreach (var cc in recess.TruePositions()) { dead[cc] = true; } } } return(dead); }
public static List <LineBitmap> FindWalls(StaticAnalysisMaps staticMaps) { var cornerAndSide = staticMaps.CornerMap.BitwiseOR(staticMaps.SideMap); var res = new List <LineBitmap>(); res.AddRange(FindRunsHorx(cornerAndSide)); res.AddRange(FindRunsVert(cornerAndSide)); return(res); }
public static Map <float> CalculateWeightings(StaticAnalysisMaps input) { const float goal = 999; const float cornergoal = 1.2f; var res = input.GoalMap.ToMap(goal, 0); foreach (var corner in input.CornerMap.TruePositions()) { if (res[corner] > 0) { res[corner] *= cornergoal; } } res = AverageOver(res, input.FloorMap, input.GoalMap); foreach (var dead in input.DeadMap.TruePositions()) { res[dead] = -1; } return(res); }
public PuzzleAnalysis(Puzzle start) { Start = start; Static = new StaticAnalysisMaps(start); }
public static List <LineBitmap> FindRecesses(StaticAnalysisMaps staticMaps) => staticMaps.IndividualWalls .Where(x => staticMaps.CornerMap[x.Start] && staticMaps.CornerMap[x.End]) .ToList();