Beispiel #1
0
        private bool avaibleMoveFromLeftToRight(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Col < BoardSize - 2)
            {
                GameBoard.eCellColor oneCellRight = OthelloGameBoard.Board[i_Row, i_Col + 1].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellRight) && (oneCellRight != GameBoard.eCellColor.Empty))
                {
                    int j = i_Col + 2;
                    while ((j < BoardSize) && (OthelloGameBoard.Board[i_Row, j].CellColor != GameBoard.eCellColor.Empty))
                    {
                        if (OthelloGameBoard.Board[i_Row, j].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        j++;
                    }
                }
            }

            return(avaibleMove);
        }
Beispiel #2
0
        private bool avaibleMoveFromUpToDown(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Row < BoardSize - 2)
            {
                GameBoard.eCellColor oneCellDown = OthelloGameBoard.Board[i_Row + 1, i_Col].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellDown) && (oneCellDown != GameBoard.eCellColor.Empty))
                {
                    int i = i_Row + 2;
                    while ((i < BoardSize) && (OthelloGameBoard.Board[i, i_Col].CellColor != GameBoard.eCellColor.Empty))
                    {
                        if (OthelloGameBoard.Board[i, i_Col].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        i++;
                    }
                }
            }

            return(avaibleMove);
        }
Beispiel #3
0
        public bool avaibleMoveFromDownToUp(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Row > 1)
            {
                GameBoard.eCellColor oneCellUp = OthelloGameBoard.Board[i_Row - 1, i_Col].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellUp) && (oneCellUp != GameBoard.eCellColor.Empty))
                {
                    int i = i_Row - 2;
                    while ((i >= 0) && (OthelloGameBoard.Board[i, i_Col].CellColor != GameBoard.eCellColor.Empty))
                    {
                        if (OthelloGameBoard.Board[i, i_Col].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        i--;
                    }
                }
            }

            return(avaibleMove);
        }
Beispiel #4
0
        private bool avaibleMoveDiagonalDownLeft(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Row < BoardSize - 2 && i_Col > 1)
            {
                GameBoard.eCellColor oneCellDiagonalDownRight = OthelloGameBoard.Board[i_Row + 1, i_Col - 1].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellDiagonalDownRight) && (oneCellDiagonalDownRight != GameBoard.eCellColor.Empty))
                {
                    int i = i_Row + 2;
                    int j = i_Col - 2;

                    while (i < BoardSize && j >= 0 && OthelloGameBoard.Board[i, j].CellColor != GameBoard.eCellColor.Empty)
                    {
                        if (OthelloGameBoard.Board[i, j].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        i++;
                        j--;
                    }
                }
            }

            return(avaibleMove);
        }
Beispiel #5
0
        private bool avaibleMoveDiagonalUpRight(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Row > 1 && i_Col < BoardSize - 2)
            {
                GameBoard.eCellColor oneCellDiagonalUpRight = OthelloGameBoard.Board[i_Row - 1, i_Col + 1].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellDiagonalUpRight) && (oneCellDiagonalUpRight != GameBoard.eCellColor.Empty))
                {
                    int i = i_Row - 2;
                    int j = i_Col + 2;

                    while (i >= 0 && j < BoardSize && OthelloGameBoard.Board[i, j].CellColor != GameBoard.eCellColor.Empty)
                    {
                        if (OthelloGameBoard.Board[i, j].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        i--;
                        j++;
                    }
                }
            }

            return(avaibleMove);
        }
Beispiel #6
0
        private bool avaibleMoveFromRightToLeft(int i_Row, int i_Col, Player i_CurrentPlayer)
        {
            bool avaibleMove = false;

            if (i_Col > 1)
            {
                GameBoard.eCellColor oneCellLeft = OthelloGameBoard.Board[i_Row, i_Col - 1].CellColor;
                if ((i_CurrentPlayer.PlayerColor != oneCellLeft) && (oneCellLeft != GameBoard.eCellColor.Empty))
                {
                    int j = i_Col - 2;
                    while ((j >= 0) && (OthelloGameBoard.Board[i_Row, j].CellColor != GameBoard.eCellColor.Empty))
                    {
                        if (OthelloGameBoard.Board[i_Row, j].CellColor == i_CurrentPlayer.PlayerColor)
                        {
                            avaibleMove = true;
                            break;
                        }

                        j--;
                    }
                }
            }

            return(avaibleMove);
        }