Ejemplo n.º 1
0
        private int GetKeeperPos()
        {
            var firstTouchColor = ColorToKeeperTouchPoint.First().Key;
            var firstTouchPoint = ColorToKeeperTouchPoint[firstTouchColor].First();

            return(GetPosition(firstTouchPoint.Key, firstTouchPoint.Position));
        }
Ejemplo n.º 2
0
        private void PopulateColorToKeeperTouchPoints(Key key, char currentColor, int currentPosition)
        {
            if (!ColorToKeeperTouchPoint.ContainsKey(currentColor))
            {
                ColorToKeeperTouchPoint.Add(currentColor, new List <SokobanPathItem>());
            }

            ColorToKeeperTouchPoint[currentColor].Add(new SokobanPathItem()
            {
                Position      = currentPosition,
                Key           = key,
                StepsToTarget = 1
            });
        }
Ejemplo n.º 3
0
        private bool CanMoveKeeper(Key key)
        {
            var firstTouchColor = ColorToKeeperTouchPoint.First().Key;
            var firstTouchPoint = ColorToKeeperTouchPoint[firstTouchColor].First();

            var keeperPos       = GetPosition(firstTouchPoint.Key, firstTouchPoint.Position);
            var targetKeeperPos = GetPosition(key, keeperPos);

            if (ColorToKeeperTouchPoint.ContainsKey(colorMap[targetKeeperPos]) || colorMap[targetKeeperPos] == LocationColorIndex)
            {
                return(true);
            }
            else if (colorMap[targetKeeperPos] == BOX ||
                     colorMap[targetKeeperPos] == BOX_ON_LOCATION)
            {
                int tmp;
                return(CanMoveBox(key, targetKeeperPos, out tmp));
            }

            return(false);
        }