This commit is contained in:
ryuga4 2019-04-23 09:30:16 +02:00
parent 39776ce06a
commit d26d9e1bc8
4 changed files with 45 additions and 23 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="imageFilePath" value="C:\Users\micjan11\Projekty\Czoko_Smieciarka\Trunk\MonoGameView\map.bmp"/> <add key="imageFilePath" value="C:\Users\micjan11\Projekty\Czoko_Smieciarka\Trunk\MonoGameView\map2.bmp"/>
<add key="outputFilePath" value="C:\Users\micjan11\Projekty\Czoko_Smieciarka\Trunk\MonoGameView\bin\Windows\x86\Debug\map.xml"/> <add key="outputFilePath" value="C:\Users\micjan11\Projekty\Czoko_Smieciarka\Trunk\MonoGameView\bin\Windows\x86\Debug\map.xml"/>
</appSettings> </appSettings>
<startup> <startup>

View File

@ -51,6 +51,9 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms
var result = new List<IStep>(); var result = new List<IStep>();
if (!(collector.TrashContainers.Any(x => x.FillPercent > 0) && grid[collector.Coords.X,collector.Coords.Y] is ADump))
{
var moveSteps = new List<IStep>() var moveSteps = new List<IStep>()
{ {
new MoveStep(Direction.Up), new MoveStep(Direction.Up),
@ -67,7 +70,7 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms
item.Invoke(copyCollector, grid); item.Invoke(copyCollector, grid);
var gcx = copyCollector.Coords.X; var gcx = copyCollector.Coords.X;
var gcy = copyCollector.Coords.Y; var gcy = copyCollector.Coords.Y;
if (grid[gcx, gcy] is Road1 || grid[gcx, gcy] is House || grid[gcx, gcy] is ADump) 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); result.Add(item);
} }
@ -77,6 +80,9 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms
} }
} }
}
if (grid[collector.Coords.X, collector.Coords.Y] is IGarbageLocalization) if (grid[collector.Coords.X, collector.Coords.Y] is IGarbageLocalization)
{ {
var collectSteps = new List<IStep>() var collectSteps = new List<IStep>()
@ -132,7 +138,7 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms
KeyValuePair<List<IStep>, int> Search(ContentManager content, GarbageCollector collector, ICloneable[,] grid, int length) KeyValuePair<List<IStep>, int> Search(ContentManager content, GarbageCollector collector, ICloneable[,] grid, int length)
{ {
if (length > 200) return new KeyValuePair<List<IStep>, int>(null,length); if (length > 100) return new KeyValuePair<List<IStep>, int>(null,length);
count++; count++;
if (Houses.All(c => (grid[c.X, c.Y] as IGarbageLocalization).TrashCans.All(j => j.FillPercent == 0.0)) if (Houses.All(c => (grid[c.X, c.Y] as IGarbageLocalization).TrashCans.All(j => j.FillPercent == 0.0))
&& &&

View File

@ -53,7 +53,7 @@ namespace CzokoŚmieciarka.MonoGameView
ImageContainer.InitContainer(Content); ImageContainer.InitContainer(Content);
// TODO: Add your initialization logic here // TODO: Add your initialization logic here
timer = 5f; timer = 0f;
mapLoader.Load(out size,out grid,"map.xml"); mapLoader.Load(out size,out grid,"map.xml");
var containers = new List<GarbageCollectorContainer>() var containers = new List<GarbageCollectorContainer>()
@ -61,8 +61,24 @@ namespace CzokoŚmieciarka.MonoGameView
new GarbageCollectorContainer( new GarbageCollectorContainer(
new TypeOfGarbage(GarbageType.Glass,50,1), new TypeOfGarbage(GarbageType.Glass,50,1),
100, 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); collector = new GarbageCollector(new Coords(0,0), containers, size, size);

BIN
Trunk/MonoGameView/map2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B