public ColorMap MoveKeeper(SokobanPathItem touchPoint) { var keeperPos = GetKeeperPos(); var targetKeeperPos = GetPosition(touchPoint.Key, touchPoint.Position); return(MoveKeeper(touchPoint.Key, keeperPos, targetKeeperPos)); }
private static List <int> GetBoxesToExit(INavigator navigator, SokobanPathItem entryPoint) { var boxes = new List <int>(); //var areasToBoxTouchPoints = GetAreasToBoxesTouchPoints(navigator); //var keeperPos = navigator.GetKeeperPosition(); //var keeperArea = areasToBoxTouchPoints.Where(x => x.Value.Positions.Contains(keeperPos)).First(); navigator.Foreach(new[] { Sokoban.BOX_ON_LOCATION }, (box) => { var keeperPos = navigator.GetKeeperPosition(); var keeperTarget = navigator.GetPosition(navigator.GetOppositeKey(entryPoint.Key), keeperPos); var targetBoxPos = entryPoint.Position; if (navigator.CanDrag(keeperPos, box, keeperTarget.Value, targetBoxPos)) { boxes.Add(box); } //var keeperToBoxTouchPoints = keeperArea.Value.EntryPoints.Where(ep => navigator.GetPosition(ep.Key, ep.Position).Value == box).ToList(); //var isKeeperCanTouchBox = keeperToBoxTouchPoints.Count > 0; //if (isKeeperCanTouchBox && CanDrag(box, navigator, entryPoint, keeperToBoxTouchPoints)) //{ // boxes.Add(box); //} }); return(boxes); }
public static bool CanDrag(int box, INavigator navigator, SokobanPathItem toExitPoint, List <SokobanPathItem> fromKeeperToBoxTouchPoints) { foreach (var fromKeeperToBoxTouchPoint in fromKeeperToBoxTouchPoints) { } return(false); }
private void AddEntryPoint(Dictionary <int, List <SokobanPathItem> > graph, int position, Key key, int neighbor) { var entryPoint = new SokobanPathItem() { Position = position, Key = key, StepsToTarget = 1 }; if (!graph.ContainsKey(neighbor)) { graph.Add(neighbor, new List <SokobanPathItem>()); } graph[neighbor].Add(entryPoint); }
private void ApplyTouchPointThickness(SokobanPathItem touchPoint, Border border) { var thickness = border.BorderThickness; if (touchPoint.Key == Key.Left) { thickness.Left = TouchPointBorder; } else if (touchPoint.Key == Key.Up) { thickness.Top = TouchPointBorder; } else if (touchPoint.Key == Key.Right) { thickness.Right = TouchPointBorder; } else if (touchPoint.Key == Key.Down) { thickness.Bottom = TouchPointBorder; } border.BorderThickness = thickness; }