public static IEnumerable <Neighbours> GetNeighboursBFS(CellState[] array, int xyPoint, int _width, int _height)
 {
     if (!MazeHelper.CheckIfLeftBorder(_width, xyPoint) && !array[xyPoint].HasFlag(CellState.West))
     {
         yield return new Neighbours {
                    NeighbourLocation = xyPoint - 1, Direction = WEST_MOVEMENT
         }
     }
     ;
     if (!MazeHelper.CheckIfUpperBorder(_width, xyPoint) && !array[xyPoint].HasFlag(CellState.North))
     {
         yield return new Neighbours {
                    NeighbourLocation = xyPoint - _width, Direction = NORTH_MOVEMENT
         }
     }
     ;;
     if (!MazeHelper.CheckIfRightBorder(_width, xyPoint) && !array[xyPoint + 1].HasFlag(CellState.West))
     {
         yield return new Neighbours {
                    NeighbourLocation = xyPoint + 1, Direction = EAST_MOVEMENT
         }
     }
     ;
     if (!MazeHelper.CheckIfLowerBorder(_width, _height, xyPoint) && !array[xyPoint + _width].HasFlag(CellState.North))
     {
         yield return new Neighbours {
                    NeighbourLocation = xyPoint + _width, Direction = SOUTH_MOVEMENT
         }
     }
     ;
 }
        public static int GetRandomLegalMovement(Maze maze)
        {
            List <int> legalMoves = new List <int>();

            Random random     = new Random();
            int    DomokunId  = maze.GetDomokunId();
            int    mazeWidth  = maze.GetMazeWidth();
            int    mazeHeight = maze.GetMazeHeight();

            CellState[] cells = maze.GetCells();

            if (!MazeHelper.CheckIfUpperBorder(mazeWidth, DomokunId) && !cells[DomokunId].HasFlag(CellState.North))
            {
                legalMoves.Add(NORTH_MOVEMENT);
            }
            if (!MazeHelper.CheckIfRightBorder(mazeWidth, DomokunId) && !cells[DomokunId].HasFlag(CellState.West))
            {
                legalMoves.Add(WEST_MOVEMENT);
            }
            if (!MazeHelper.CheckIfLowerBorder(mazeWidth, mazeHeight, DomokunId) && !cells[DomokunId + mazeWidth].HasFlag(CellState.North))
            {
                legalMoves.Add(SOUTH_MOVEMENT);
            }
            if (!MazeHelper.CheckIfLeftBorder(mazeWidth, DomokunId) && !cells[DomokunId + 1].HasFlag(CellState.West))
            {
                legalMoves.Add(EAST_MOVEMENT);
            }

            return(legalMoves[random.Next(legalMoves.Count)]);
        }