public static string Print(this FloorPlan floorPlan, List <Location> path = null) { if (path == null) { path = new List <Location>(); } var sb = new StringBuilder(); var maxRow = floorPlan.FloorTiles.Max(x => x.Y); var maxCol = floorPlan.FloorTiles.Max(x => x.X); for (int row = 0; row <= maxRow; row++) { for (int col = 0; col <= maxCol; col++) { if (floorPlan.IsAgentOnTile(col, row)) { sb.Append("@"); } else if (path.Contains(new Location(col, row))) { sb.Append(path.IndexOf(new Location(col, row)).ToLetter()); //sb.Append("="); } else { var tile = floorPlan.GetFloorTile(col, row); sb.Append(tile.Print()); } } sb.AppendLine(); } string output = sb.ToString(); return(output); }
public static ITile GetEast(this FloorPlan floorPlan, ITile floorTile) { return(floorPlan.FloorTiles.SingleOrDefault(t => t.X == floorTile?.X + 1 && t.Y == floorTile?.Y)); }
public static ITile GetFloorTile(this FloorPlan floorPlan, int x, int y) { return(floorPlan.FloorTiles.GetFloorTile(x, y)); }
public static ITile GetSouth(this FloorPlan floorPlan, ITile floorTile) { return(floorPlan.FloorTiles.SingleOrDefault(t => t.X == floorTile?.X && t.Y == floorTile?.Y + 1)); }