コード例 #1
0
        internal bool IsPreformedMove()
        {
            CheckersPiece pieceToMove = r_GameBoard.GetCell(r_CurremtRow, r_CurrentColumn).Piece;
            bool          isLegalMove = false;

            m_IsNeedToEatAgain = false;

            UpdateAllPlayerPieces(r_Player);

            bool isValidPlayerPiece = isValidPiece(pieceToMove);

            if (isValidPlayerPiece && IsPlayerMustEat(r_Player))
            {
                if (isLegalMove = isMoveInList(pieceToMove.PossibleEatMoves))
                {
                    makeEatMove(pieceToMove);
                    m_IsNeedToEatAgain = pieceToMove.PossibleEatMoves.Any();
                }
            }
            else if (isValidPlayerPiece && isSimpleMoveLeft() && !m_IsNeedToEatAgain)
            {
                if (isLegalMove = isMoveInList(pieceToMove.PossibleSimpleMoves))
                {
                    makeSimpleMove(pieceToMove);
                }
            }

            updateEndOfMove();

            return(isLegalMove);
        }
コード例 #2
0
        public string GetCellPieceType(int i_Row, int i_Col)
        {
            string pieceType;

            if (m_GameBoard.GetCell(i_Row, i_Col).Piece != null)
            {
                pieceType = m_GameBoard.GetCell(i_Row, i_Col).Piece.PieceType.ToString();
            }
            else
            {
                pieceType = k_EmptyCell;
            }

            return(pieceType);
        }