コード例 #1
0
        private void checkIfcanMoveUpAndLeft(Piece i_Piece, ref List <Move> o_ValidMoves)
        {
            int           row         = i_Piece.Row;
            int           column      = i_Piece.Column;
            e_CellContent cellContent = i_Piece.CellContent;

            if (cellContent == e_CellContent.Black || i_Piece.CheckIfKing())
            {
                if (row > 0 && column > 0)
                {
                    if (GameBoard[row - 1, column - 1].CellContent == e_CellContent.Empty)
                    {
                        Move move = new Move(row, column, row - 1, column - 1);
                        o_ValidMoves.Add(move);
                    }
                }
            }
        }
コード例 #2
0
        private void checkIfcanMoveDownAndRight(Piece i_Piece, ref List <Move> o_ValidMoves)
        {
            int           row         = i_Piece.Row;
            int           column      = i_Piece.Column;
            e_CellContent cellContent = i_Piece.CellContent;

            if (cellContent == e_CellContent.Red || i_Piece.CheckIfKing())
            {
                if (row < (Dimension - 1) && column < (Dimension - 1))
                {
                    if (GameBoard[row + 1, column + 1].CellContent == e_CellContent.Empty)
                    {
                        Move move = new Move(row, column, row + 1, column + 1);
                        o_ValidMoves.Add(move);
                    }
                }
            }
        }
コード例 #3
0
        private void updatePlayerScoreAfterJump(e_CellContent i_CellContent)
        {
            if (i_CellContent == e_CellContent.Black)
            {
                BlackCurrentScore--;
            }

            if (i_CellContent == e_CellContent.BlackKing)
            {
                BlackCurrentScore -= 4;
            }

            if (i_CellContent == e_CellContent.Red)
            {
                RedCurrentScore--;
            }

            if (i_CellContent == e_CellContent.RedKing)
            {
                RedCurrentScore -= 4;
            }
        }
コード例 #4
0
        private void checkIfcanJumpUpAndLeft(Piece i_Piece, ref List <Move> o_ValidJumpMoves)
        {
            int           row                = i_Piece.Row;
            int           column             = i_Piece.Column;
            e_CellContent cellContent        = i_Piece.CellContent;
            e_CellContent jumpOverPlainPiece = i_Piece.GetMyOpponentPlainPieceType();
            e_CellContent jumpOverKingPiece  = i_Piece.GetMyOpponentKingPieceType();

            if (cellContent == e_CellContent.Black || i_Piece.CheckIfKing())
            {
                if (row > 1 && column > 1)
                {
                    e_CellContent pieceToEat = GameBoard[row - 1, column - 1].CellContent;
                    if (pieceToEat == jumpOverPlainPiece || pieceToEat == jumpOverKingPiece)
                    {
                        if (GameBoard[row - 2, column - 2].CellContent == e_CellContent.Empty)
                        {
                            Move move = new Move(row, column, row - 2, column - 2);
                            o_ValidJumpMoves.Add(move);
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void checkIfcanJumpDownAndRight(Piece i_Piece, ref List <Move> o_ValidJumpMoves)
        {
            int           row                = i_Piece.Row;
            int           column             = i_Piece.Column;
            e_CellContent cellContent        = i_Piece.CellContent;
            e_CellContent jumpOverPlainPiece = i_Piece.GetMyOpponentPlainPieceType();
            e_CellContent jumpOverKingPiece  = i_Piece.GetMyOpponentKingPieceType();

            if (cellContent == e_CellContent.Red || i_Piece.CheckIfKing())
            {
                if (row < (Dimension - 2) && column < (Dimension - 2))
                {
                    e_CellContent pieceToEat = GameBoard[row + 1, column + 1].CellContent;
                    if (pieceToEat == jumpOverPlainPiece || pieceToEat == jumpOverKingPiece)
                    {
                        if (GameBoard[row + 2, column + 2].CellContent == e_CellContent.Empty)
                        {
                            Move move = new Move(row, column, row + 2, column + 2);
                            o_ValidJumpMoves.Add(move);
                        }
                    }
                }
            }
        }
コード例 #6
0
ファイル: Piece.cs プロジェクト: danakeydar/Checkers
 public Piece(e_CellContent i_CellContent, int i_Row, int i_Column)
 {
     m_CellContent = i_CellContent;
     m_Row         = i_Row;
     m_Column      = i_Column;
 }
コード例 #7
0
ファイル: Cell.cs プロジェクト: danakeydar/Checkers
 public void RemovePiece()
 {
     CellContent = e_CellContent.Empty;
 }