Beispiel #1
0
        private PieceMove               findSpecificEatingMoves(GamePiece i_Piece, Player.eDirection i_VerticalDirection, Player.eDirection i_HorizontalDirection)
        {
            PieceMove EatingMove    = null;
            int       pieceToEatRow = i_Piece.Location.Y + (int)i_VerticalDirection;
            int       pieceToEatCol = i_Piece.Location.X + (int)i_HorizontalDirection;

            if (isCoordinateInBoard(pieceToEatRow, pieceToEatCol))
            {
                Player leftSquareOwner = getSquareOwnership(pieceToEatRow, pieceToEatCol);
                if (leftSquareOwner != null && leftSquareOwner != i_Piece.Owner)
                {
                    int squareToJumpToRow = pieceToEatRow + (int)i_VerticalDirection;
                    int squareToJumpToCol = pieceToEatCol + (int)i_HorizontalDirection;
                    if (isCoordinateInBoard(squareToJumpToRow, squareToJumpToCol))
                    {
                        if (getSquareOwnership(squareToJumpToRow, squareToJumpToCol) == null)
                        {
                            Point destination = new Point(squareToJumpToCol, squareToJumpToRow);
                            EatingMove = new PieceMove(i_Piece.Location, destination, true);
                        }
                    }
                }
            }

            return(EatingMove);
        }
Beispiel #2
0
        public GamePiece               FindEatenPiece(PieceMove i_EatingMove)
        {
            Point eatenPieceLocation;
            Point difference = i_EatingMove.Destination - i_EatingMove.Location;

            difference         = difference / 2;
            eatenPieceLocation = i_EatingMove.Location + difference;
            return(m_Board[eatenPieceLocation.Y, eatenPieceLocation.X]);
        }
Beispiel #3
0
        private PieceMove               findSpecificSteppingMove(Point i_Location, Player.eDirection i_VerticalDirection, Player.eDirection i_HorizontalDirection)
        {
            PieceMove steppingMove = null;
            int       row          = i_Location.Y + (int)i_VerticalDirection;
            int       col          = i_Location.X + (int)i_HorizontalDirection;

            if (isCoordinateInBoard(row, col) && getSquareOwnership(row, col) == null)
            {
                Point destination = new Point(col, row);
                steppingMove = new PieceMove(i_Location, destination, false);
            }

            return(steppingMove);
        }
Beispiel #4
0
        private List <PieceMove> findEatingMoves(GamePiece i_Piece, Player.eDirection i_VerticalDirection)
        {
            List <PieceMove> currentPieceEatingMoves = new List <PieceMove>(2);
            PieceMove        currentPieceEatingLeft  = findSpecificEatingMoves(i_Piece, i_VerticalDirection, Player.eDirection.LEFT);
            PieceMove        currentPieceEatingRight = findSpecificEatingMoves(i_Piece, i_VerticalDirection, Player.eDirection.RIGHT);

            if (currentPieceEatingLeft != null)
            {
                currentPieceEatingMoves.Add(currentPieceEatingLeft);
            }

            if (currentPieceEatingRight != null)
            {
                currentPieceEatingMoves.Add(currentPieceEatingRight);
            }

            return(currentPieceEatingMoves);
        }
Beispiel #5
0
        private List <PieceMove> findSteppingForwardMoves(GamePiece i_GamePiece, Player.eDirection i_VerticalDirection)
        {
            List <PieceMove> currentPieceSteppingForward = new List <PieceMove>(2);
            PieceMove        currentPieceSteppingLeft    = findSpecificSteppingMove(i_GamePiece.Location, i_VerticalDirection, Player.eDirection.LEFT);
            PieceMove        currentPieceSteppingRight   = findSpecificSteppingMove(i_GamePiece.Location, i_VerticalDirection, Player.eDirection.RIGHT);

            if (currentPieceSteppingLeft != null)
            {
                currentPieceSteppingForward.Add(currentPieceSteppingLeft);
            }

            if (currentPieceSteppingRight != null)
            {
                currentPieceSteppingForward.Add(currentPieceSteppingRight);
            }

            return(currentPieceSteppingForward);
        }