Example #1
0
        internal void MoveOnBoard(BoardGame i_BoardGame)
        {
            Square fromSquare = i_BoardGame.GetSquare(this.FromSquare.Row, this.FromSquare.Column);
            Square toSquare   = i_BoardGame.GetSquare(this.ToSquare.Row, this.ToSquare.Column);

            switch (this.MoveType)
            {
            case (eTypeOfMove.Regular):

                if (fromSquare.Type == Square.eSquareType.X && toSquare.Row == 0)
                {
                    toSquare.Type = Square.eSquareType.K;
                }

                else
                if (fromSquare.Type == Square.eSquareType.O && toSquare.Row == i_BoardGame.GetSize() - 1)
                {
                    toSquare.Type = Square.eSquareType.U;
                }
                else
                {
                    toSquare.Type = fromSquare.Type;
                }
                fromSquare.Type = Square.eSquareType.None;

                break;

            case (eTypeOfMove.Jump):
                capturePieceOnBoard(i_BoardGame);

                if (fromSquare.Type == Square.eSquareType.X && toSquare.Row == 0)
                {
                    toSquare.Type = Square.eSquareType.K;
                }

                else
                {
                    if (fromSquare.Type == Square.eSquareType.O && toSquare.Row == i_BoardGame.GetSize() - 1)
                    {
                        toSquare.Type = Square.eSquareType.U;
                    }
                    else
                    {
                        toSquare.Type = fromSquare.Type;
                    }
                }
                fromSquare.Type = Square.eSquareType.None;
                break;
            }


            i_BoardGame.PrintBoard();
        }