:/
This commit is contained in:
parent
39776ce06a
commit
d26d9e1bc8
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<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"/>
|
||||
</appSettings>
|
||||
<startup>
|
||||
|
@ -51,31 +51,37 @@ namespace CzokoŚmieciarka.MonoGameView.Algorithms
|
||||
|
||||
|
||||
var result = new List<IStep>();
|
||||
var moveSteps = new List<IStep>()
|
||||
|
||||
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<IStep>();
|
||||
foreach (var item in moveSteps)
|
||||
{
|
||||
var copyCollector = (AGarbageCollector)collector.Clone();
|
||||
try
|
||||
var moveSteps = new List<IStep>()
|
||||
{
|
||||
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<IStep>();
|
||||
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<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++;
|
||||
if (Houses.All(c => (grid[c.X, c.Y] as IGarbageLocalization).TrashCans.All(j => j.FillPercent == 0.0))
|
||||
&&
|
||||
|
@ -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<GarbageCollectorContainer>()
|
||||
@ -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);
|
||||
|
||||
|
BIN
Trunk/MonoGameView/map2.bmp
Normal file
BIN
Trunk/MonoGameView/map2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 442 B |
Loading…
Reference in New Issue
Block a user