Esempio n. 1
0
        internal static Path GetPathForLeftStartPoint(Point start, int stepsRemaining)
        {
            // The path for starting on the left side of the board is Up, Right, then Down.
            var result = new Path();
            if (stepsRemaining > 0)
            {
                result.Up = 1;
                stepsRemaining--;
                if (stepsRemaining > 0)
                {
                    result.Right = stepsRemaining > start.Y ? start.Y : stepsRemaining;
                    stepsRemaining = stepsRemaining - result.Right;
                    if (stepsRemaining > 0)
                    {
                        result.Down = stepsRemaining;
                    }
                }
            }

            return result;
        }
Esempio n. 2
0
        internal static Path GetPathForBottomStartPoint(Point start, int stepsRemaining)
        {
            // The path for starting on the bottom of the board is Right, Up, then Left.
            var result = new Path();
            if (stepsRemaining > 0)
            {
                result.Right = 1;
                stepsRemaining--;
                if (stepsRemaining > 0)
                {
                    result.Up = stepsRemaining > start.X ? start.X : stepsRemaining;
                    stepsRemaining = stepsRemaining - result.Up;
                    if (stepsRemaining > 0)
                    {
                        result.Left = stepsRemaining;
                    }
                }
            }

            return result;
        }