コード例 #1
0
ファイル: Board.cs プロジェクト: stedevine/ACM
        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;
        }
コード例 #2
0
ファイル: Board.cs プロジェクト: stedevine/ACM
        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;
        }