From f6e30ed8488c86b7b1eb32ef0899fedda7fa1c91 Mon Sep 17 00:00:00 2001 From: ryuga4 Date: Sat, 8 Jun 2019 14:12:15 +0200 Subject: [PATCH] dane --- .../Algorithms/BestFirstSearch.cs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Trunk/MonoGameView/Algorithms/BestFirstSearch.cs b/Trunk/MonoGameView/Algorithms/BestFirstSearch.cs index 77aab5b..8171525 100644 --- a/Trunk/MonoGameView/Algorithms/BestFirstSearch.cs +++ b/Trunk/MonoGameView/Algorithms/BestFirstSearch.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using Microsoft.Xna.Framework.Content; using System.Threading; using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models; +using MonoGameView.DataModels.Models; namespace MonoGameView.Algorithms { @@ -50,12 +51,69 @@ namespace MonoGameView.Algorithms var r = SearchBestFirst(content, collector, grid, 0); + + + var dataToLog = Jazda(r.Item1, CopyGrid(grid), (GarbageCollector) collector.Clone()).ToList(); + + + Console.WriteLine($"Counts : {count}"); if (r == null) return new Tuple, int, List>(new List(), 0, new List()); return r; } + + public IEnumerable> Jazda(List steps, ICloneable[,] grid, GarbageCollector collector) + { + + + for (int i =0;i= 0 && y >= 0 && x < grid.GetLength(0) && y < grid.GetLength(1)) + { + + + var cell = grid[x, y]; + + if (cell is Grass) minGrid[xoffset, yoffset] = "grass"; + if (cell is Road1) minGrid[xoffset, yoffset] = "road1"; + if (cell is Road2) minGrid[xoffset, yoffset] = "road2"; + if (cell is Dump) minGrid[xoffset, yoffset] = (cell as Dump).TypeOfGarbage.GarbageType.ToString(); + if (cell is House) minGrid[xoffset, yoffset] = "house"; + if (cell is EmptyHouse) minGrid[xoffset, yoffset] = "emptyHouse"; + } else + { + minGrid[xoffset, yoffset] = "grass"; + } + } + } + yield return new KeyValuePair(steps[i], minGrid); + + + + + steps[i].Invoke(collector, grid); + + + } + + + + } + + + + List PossibleSteps(AGarbageCollector collector, ICloneable[,] grid) {