Ejemplo n.º 1
0
        public override bool DoMove(int firstCube, int secondCube)
        {
            int  sum;
            bool isMoved = false;

            if (this.Status == GameStatus.Start)
            {
                if ((!Rull.IsValidMoveForStart(firstCube)) && (!Rull.IsValidMoveForStart(secondCube)))
                {
                    isMoved = false;
                    sum     = 0;
                }
                else
                {
                    isMoved = move.StartMove(firstCube, secondCube, out sum);
                }
            }
            else if (this.Status == GameStatus.Out)
            {
                if ((!Rull.IsValidMoveForOut(firstCube)) && (!Rull.IsValidMoveForOut(secondCube)))
                {
                    isMoved = false;
                    sum     = 0;
                }
                else
                {
                    isMoved = move.OutMove(firstCube, secondCube, out sum);
                }
            }
            else
            {
                if ((!Rull.IsValidMoveForFinish(firstCube)) && (!Rull.IsValidMoveForFinish(secondCube)))
                {
                    isMoved = false;
                    sum     = 0;
                }
                else
                {
                    isMoved = move.FinishMove(firstCube, secondCube, out sum);
                }
            }
            Status = Rull.CheckStatus();
            UpdateSum(sum);
            return(isMoved);
        }
Ejemplo n.º 2
0
        public override bool DoMove(int panel, int steps)
        {
            int             sum;
            BackgammonBoard board   = BackgammonBoard.Instance;
            bool            isMoved = false;

            if (this.Status == GameStatus.Start)
            {
                isMoved = move.StartMove(panel, steps, out sum);
            }
            else if (this.Status == GameStatus.Out)
            {
                isMoved = move.OutMove(panel, steps, out sum);
            }
            else
            {
                isMoved = move.FinishMove(panel, steps, out sum);
            }
            Status = Rull.CheckStatus();
            UpdateSum(sum);
            return(isMoved);
        }