diff --git a/Trunk/Helper Programs/MapEditor/MapEditor/App.config b/Trunk/Helper Programs/MapEditor/MapEditor/App.config index 77d206f..faa5528 100644 --- a/Trunk/Helper Programs/MapEditor/MapEditor/App.config +++ b/Trunk/Helper Programs/MapEditor/MapEditor/App.config @@ -1,7 +1,7 @@  - + diff --git a/Trunk/MonoGameView/Algorithms/DFS.cs b/Trunk/MonoGameView/Algorithms/DFS.cs index 2efbc2c..28f1fa8 100644 --- a/Trunk/MonoGameView/Algorithms/DFS.cs +++ b/Trunk/MonoGameView/Algorithms/DFS.cs @@ -51,31 +51,37 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms var result = new List(); - var moveSteps = new List() + + if (!(collector.TrashContainers.Any(x => x.FillPercent > 0) && grid[collector.Coords.X,collector.Coords.Y] is ADump)) { - new MoveStep(Direction.Up), - new MoveStep(Direction.Down), - new MoveStep(Direction.Left), - new MoveStep(Direction.Right) - }; - var filteredMoveSteps = new List(); - foreach (var item in moveSteps) - { - var copyCollector = (AGarbageCollector)collector.Clone(); - try + var moveSteps = new List() { - item.Invoke(copyCollector, grid); - var gcx = copyCollector.Coords.X; - var gcy = copyCollector.Coords.Y; - if (grid[gcx, gcy] is Road1 || grid[gcx, gcy] is House || grid[gcx, gcy] is ADump) + new MoveStep(Direction.Up), + new MoveStep(Direction.Down), + new MoveStep(Direction.Left), + new MoveStep(Direction.Right) + }; + var filteredMoveSteps = new List(); + foreach (var item in moveSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(); + try { - result.Add(item); + item.Invoke(copyCollector, grid); + var gcx = copyCollector.Coords.X; + var gcy = copyCollector.Coords.Y; + if (grid[gcx, gcy] is Road1 || grid[gcx, gcy] is House || (grid[gcx, gcy] is ADump && copyCollector.TrashContainers.Any(x=>x.FillPercent>0))) + { + result.Add(item); + } + } + catch (Exception e) + { + } } - catch (Exception e) - { - } + } if (grid[collector.Coords.X, collector.Coords.Y] is IGarbageLocalization) { @@ -132,7 +138,7 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms KeyValuePair, int> Search(ContentManager content, GarbageCollector collector, ICloneable[,] grid, int length) { - if (length > 200) return new KeyValuePair, int>(null,length); + if (length > 100) return new KeyValuePair, int>(null,length); count++; if (Houses.All(c => (grid[c.X, c.Y] as IGarbageLocalization).TrashCans.All(j => j.FillPercent == 0.0)) && diff --git a/Trunk/MonoGameView/Game1.cs b/Trunk/MonoGameView/Game1.cs index 0d826ce..45d82c2 100644 --- a/Trunk/MonoGameView/Game1.cs +++ b/Trunk/MonoGameView/Game1.cs @@ -53,7 +53,7 @@ namespace CzokoŚmieciarka.MonoGameView ImageContainer.InitContainer(Content); // TODO: Add your initialization logic here - timer = 5f; + timer = 0f; mapLoader.Load(out size,out grid,"map.xml"); var containers = new List() @@ -61,8 +61,24 @@ namespace CzokoŚmieciarka.MonoGameView new GarbageCollectorContainer( new TypeOfGarbage(GarbageType.Glass,50,1), 100, - new BasicGarbage(new TypeOfGarbage(GarbageType.Glass,50,1),1) + new BasicGarbage(new TypeOfGarbage(GarbageType.Glass,50,1),0) ), + new GarbageCollectorContainer( + new TypeOfGarbage(GarbageType.Paper,50,1), + 100, + new BasicGarbage(new TypeOfGarbage(GarbageType.Glass,50,1),0) + ), + new GarbageCollectorContainer( + new TypeOfGarbage(GarbageType.Organic,50,1), + 100, + new BasicGarbage(new TypeOfGarbage(GarbageType.Glass,50,1),0) + ), + new GarbageCollectorContainer( + new TypeOfGarbage(GarbageType.PlasticMetal,50,1), + 100, + new BasicGarbage(new TypeOfGarbage(GarbageType.Glass,50,1),0) + ), + }; collector = new GarbageCollector(new Coords(0,0), containers, size, size); diff --git a/Trunk/MonoGameView/map2.bmp b/Trunk/MonoGameView/map2.bmp new file mode 100644 index 0000000..19e0e4f Binary files /dev/null and b/Trunk/MonoGameView/map2.bmp differ