From d26d9e1bc8ef8cc05ee7bfbf41dd67ecd0d034ee Mon Sep 17 00:00:00 2001 From: ryuga4 Date: Tue, 23 Apr 2019 09:30:16 +0200 Subject: [PATCH] :/ --- .../MapEditor/MapEditor/App.config | 2 +- Trunk/MonoGameView/Algorithms/DFS.cs | 46 ++++++++++-------- Trunk/MonoGameView/Game1.cs | 20 +++++++- Trunk/MonoGameView/map2.bmp | Bin 0 -> 442 bytes 4 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 Trunk/MonoGameView/map2.bmp 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 0000000000000000000000000000000000000000..19e0e4f4fef7a07a12fe0679d78332fe332f7668 GIT binary patch literal 442 zcmZ?r-NncN230^Z2Z*_#n2|vOEbai5SJs1IumF&7at|tov5BRbh*gNJ?mxqS26P1C yLjk5FL1rHs{aEm0vih#0V{^{2+6~ZhU-Am4-rEqk(46~Lp1{_A^-pZaXMQ7 literal 0 HcmV?d00001