dane
This commit is contained in:
parent
b66d57b27d
commit
f6e30ed848
@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
|||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models;
|
using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models;
|
||||||
|
using MonoGameView.DataModels.Models;
|
||||||
|
|
||||||
namespace MonoGameView.Algorithms
|
namespace MonoGameView.Algorithms
|
||||||
{
|
{
|
||||||
@ -50,12 +51,69 @@ namespace MonoGameView.Algorithms
|
|||||||
|
|
||||||
|
|
||||||
var r = SearchBestFirst(content, collector, grid, 0);
|
var r = SearchBestFirst(content, collector, grid, 0);
|
||||||
|
|
||||||
|
|
||||||
|
var dataToLog = Jazda(r.Item1, CopyGrid(grid), (GarbageCollector) collector.Clone()).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Console.WriteLine($"Counts : {count}");
|
Console.WriteLine($"Counts : {count}");
|
||||||
if (r == null) return new Tuple<List<IStep>, int, List<ICloneable[,]>>(new List<IStep>(), 0, new List<ICloneable[,]>());
|
if (r == null) return new Tuple<List<IStep>, int, List<ICloneable[,]>>(new List<IStep>(), 0, new List<ICloneable[,]>());
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<KeyValuePair<IStep, ICloneable[,]>> Jazda(List<IStep> steps, ICloneable[,] grid, GarbageCollector collector)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
for (int i =0;i<steps.Count();i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
var minGrid = new ICloneable[5, 5];
|
||||||
|
|
||||||
|
for (int x = collector.Coords.X-2; x <= collector.Coords.X+2;x++)
|
||||||
|
{
|
||||||
|
for (int y = collector.Coords.Y-2;y <= collector.Coords.Y+2;y++)
|
||||||
|
{
|
||||||
|
var xoffset = x - (collector.Coords.X - 2);
|
||||||
|
var yoffset = y - (collector.Coords.Y - 2);
|
||||||
|
if (x >= 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<IStep, ICloneable[,]>(steps[i], minGrid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
steps[i].Invoke(collector, grid);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<IStep> PossibleSteps(AGarbageCollector collector, ICloneable[,] grid)
|
List<IStep> PossibleSteps(AGarbageCollector collector, ICloneable[,] grid)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user