diff --git a/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj b/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj index 756d35c..b58cd80 100644 --- a/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj +++ b/Trunk/Components/CzokoŚmieciarka.AI_Naive/CzokoŚmieciarka.AI_Naive.csproj @@ -1,54 +1,58 @@ - - - - - Debug - AnyCPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A} - Library - Properties - CzokoŚmieciarka.AI_Naive - CzokoŚmieciarka.AI_Naive - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - - + + + + + Debug + AnyCPU + {10E77BBE-55E1-483D-A456-0E94EAC9B24A} + Library + Properties + CzokoŚmieciarka.AI_Naive + CzokoŚmieciarka.AI_Naive + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} + CzokoŚmieciarka.DataModels.GeneralModels + + + {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} + CzokoŚmieciarka.DataModels + + + \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs b/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs index ed0112a..0442add 100644 --- a/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs +++ b/Trunk/Components/CzokoŚmieciarka.AI_Naive/RoutePlanningEngine.cs @@ -1,5 +1,7 @@ using CzokoŚmieciarka.DataModels.Enums; using CzokoŚmieciarka.DataModels.Interfaces; + +using CzokoŚmieciarka.DataModels.Interfaces.Road; using CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine; using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; using CzokoŚmieciarka.DataModels.Models; @@ -11,106 +13,51 @@ using System.Linq; namespace Czoko_Smieciarka.AI_Naive { public class RoutePlanningEngine : IRoutePlanningEngine - { - public IGarbageCollector Collector { get; } - public IEnumerable Cans { get; } - public IEnumerable Dumps { get; } - - - - enum State { TravelToDump, TravelToCan, Wait, Finish } - public Coords Destination { get; set; } - public object DestinationObject { get; set; } - private State CurrentState { get; set; } - - public void PerformStep() - { - PerformMove(); - } - - public RoutePlanningEngine(IGarbageCollector collector, IEnumerable cans, IEnumerable dumps) - { - this.Collector = collector; - this.Cans = cans; - this.Dumps = dumps; - this.CurrentState = State.Wait; - } - - - private bool PerformMove() - { - - switch (CurrentState) - { - case State.TravelToDump: - if (Destination == Collector.Coords) - { - var dump = (DestinationObject as ADump); - var step = new SpillStep(Collector, dump, dump.TypeOfGarbage); - step.Invoke(); - this.CurrentState = State.Wait; - } - else - { - var dif = Destination - Collector.Coords; - Direction nextDirection = (dif.X == 0) ? - ((dif.Y > 0) ? Direction.Up : Direction.Down) : - ((dif.X > 0) ? Direction.Right : Direction.Left); - - var step = new MoveStep(nextDirection, Collector); - step.Invoke(); - } - break; - case State.TravelToCan: - if (Destination == Collector.Coords) - { - var garbage = (DestinationObject as IGarbageLocalization); - foreach (var item in garbage.TrashCans) - { - var step = new CollectStep(Collector, garbage, item.TypeOfGarbage); - step.Invoke(); - } - - this.CurrentState = State.Wait; - } - else - { - var dif = Destination - Collector.Coords; - Direction nextDirection = (dif.X == 0) ? - ((dif.Y > 0) ? Direction.Up : Direction.Down) : - ((dif.X > 0) ? Direction.Right : Direction.Left); - - var step = new MoveStep(nextDirection, Collector); - step.Invoke(); - } - break; - case State.Wait: - var notEmpty = Collector.TrashContainers.Where(i => i.FillPercent > 0); - if (notEmpty.Any()) - { - var destDump = Dumps.First(i => i.TypeOfGarbage == notEmpty.First().TypeOfGarbage); - this.Destination = destDump.Coords; - this.CurrentState = State.TravelToDump; - } - else - { - var notEmptyCans = Cans.Where(i => i.TrashCans.Any(j => j.FillPercent > 0)); - if (notEmptyCans.Any()) - { - this.Destination = notEmptyCans.First().Coords; - this.CurrentState = State.TravelToCan; - } - else - { - this.CurrentState = State.Finish; - } - } - break; - case State.Finish: - return false; - } - return true; - - } + { + IGarbageCollector Collector { get; set; } + + IGarbageCollector CollectorClone { get; set; } + + object[,] Board { get; set; } + + object[,] BoardClone { get; set; } + + + + public IEnumerable ReturnSteps() + { + throw new NotImplementedException(); + } + + public RoutePlanningEngine(object[,] board, IGarbageCollector collector) + { + this.Collector = collector; + this.CollectorClone = (IGarbageCollector) collector.Clone(); + this.Board = board; + this.BoardClone = (object [,]) board.Clone(); + + } + + IEnumerable PossibleSteps(object[,] BoardClone, IGarbageCollector CollectorClone) + { + var x = CollectorClone.Coords.X; + var y = CollectorClone.Coords.Y; + var maxX = BoardClone.GetLength(0) - 1; + var maxY = BoardClone.GetLength(1) - 1; + + + var currentCollector = CollectorClone.Clone(); + var Moves = new List + { + new MoveStep(Direction.Left, CollectorClone), + new MoveStep(Direction.Right, CollectorClone), + new MoveStep(Direction.Up, CollectorClone), + new MoveStep(Direction.Down, CollectorClone) + } + + + } + + } } \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj index 010f889..63428d0 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj @@ -1,67 +1,69 @@ - - - - - Debug - AnyCPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7} - Library - Properties - CzokoŚmieciarka.DataModels - CzokoŚmieciarka.DataModels - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7} + Library + Properties + CzokoŚmieciarka.DataModels + CzokoŚmieciarka.DataModels + v4.6.1 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs index 3998ca2..36581ba 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs @@ -1,40 +1,40 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector -{ - public abstract class AGarbageCollector : IGarbageCollector - { - public AGarbageCollector(Coords startPosition, IEnumerable trashContainers) - { - this.Coords = startPosition; - this.TrashContainers = trashContainers; - } - public Coords Coords { get; set; } - - public Coords MoveUp() - { - return new Coords(Coords.X,Coords.Y+1); - } - - public Coords MoveDown() - { - return new Coords(Coords.X, Coords.Y - 1); - } - - public Coords MoveLeft() - { - return new Coords(Coords.X-1, Coords.Y); - } - - public Coords MoveRight() - { - return new Coords(Coords.X+1, Coords.Y); +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.DataModels.Models; + +namespace CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector +{ + public abstract class AGarbageCollector : IGarbageCollector + { + public AGarbageCollector(Coords startPosition, IEnumerable trashContainers) + { + this.Coords = startPosition; + this.TrashContainers = trashContainers; + } + public Coords Coords { get; set; } + + public Coords MoveUp() + { + return new Coords(Coords.X,Coords.Y+1); + } + + public Coords MoveDown() + { + return new Coords(Coords.X, Coords.Y - 1); + } + + public Coords MoveLeft() + { + return new Coords(Coords.X-1, Coords.Y); + } + + public Coords MoveRight() + { + return new Coords(Coords.X+1, Coords.Y); } public object Clone() @@ -42,6 +42,6 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector return this.MemberwiseClone(); } - public IEnumerable TrashContainers { get; } - } -} + public IEnumerable TrashContainers { get; } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs new file mode 100644 index 0000000..ffe723d --- /dev/null +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.DataModels.Interfaces.Road +{ + public interface IRoad + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs new file mode 100644 index 0000000..9c30c0f --- /dev/null +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Road/IRoad2.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.DataModels.Interfaces.Road +{ + public interface IRoad2 + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs index ebace0a..f20ed55 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs @@ -9,6 +9,6 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine { public interface IRoutePlanningEngine { - void PerformStep(); + IEnumerable ReturnSteps(); } } \ No newline at end of file diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj index 588269c..2f28bef 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj @@ -1,120 +1,120 @@ - - - - - Debug - AnyCPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947} - WinExe - CzokoŚmieciarka.WPFv2 - CzokoŚmieciarka.WPFv2 - v4.6.1 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - - MainWindow.xaml - Code - - - - - - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - {10e77bbe-55e1-483d-a456-0e94eac9b24a} - CzokoŚmieciarka.AI_Naive - - - {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} - CzokoŚmieciarka.DataModels.GeneralModels - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - - - + + + + + Debug + AnyCPU + {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947} + WinExe + CzokoŚmieciarka.WPFv2 + CzokoŚmieciarka.WPFv2 + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + {10e77bbe-55e1-483d-a456-0e94eac9b24a} + CzokoŚmieciarka.AI_Naive + + + {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} + CzokoŚmieciarka.DataModels.GeneralModels + + + {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} + CzokoŚmieciarka.DataModels + + + + \ No newline at end of file diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs index 114149b..ddcc2a2 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road.cs @@ -7,11 +7,12 @@ using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.DataModels.Interfaces.Road; using CzokoŚmieciarka.WPFv2.Interfaces; namespace CzokoŚmieciarka.WPFv2.Models { - class Road : IWPFObject + class Road : IWPFObject, IRoad { public string ImagePath { get; set; } public Image Image { get; set; } diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs index 10a51a2..8c818a4 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/Road2.cs @@ -7,10 +7,11 @@ using System.Windows.Controls; using System.Windows.Media.Imaging; using CzokoŚmieciarka.DataModels.Models; using CzokoŚmieciarka.WPFv2.Interfaces; +using CzokoŚmieciarka.DataModels.Interfaces.Road; namespace CzokoŚmieciarka.WPFv2.Models { - class Road2 : IWPFObject + class Road2 : IWPFObject, IRoad2 { public string ImagePath { get; set; } public Image Image { get; set; }