Exemplo n.º 1
0
        public Minefield Explore(Coordinates coordinates)
        {
            var grid = Enumerable.Range(0, _height)
                .Select(rowIndex => ExploreRow(rowIndex, coordinates)).ToList();

            return new Minefield(_width, _height, grid);
        }
Exemplo n.º 2
0
        /*

        public int GetBombsInRange(Coordinates coordinate)
        {
            int counter = 0;
            for (int rowCounter = -1; rowCounter <= 1; rowCounter++)
            {
                for (int columnCounter = -1; columnCounter <= 1; columnCounter++)
                {
                    //check for valid index
                    if (InBounds(coordinate.RowIndex + rowCounter,
                        coordinate.ColumnIndex + columnCounter))
                    {

                    }
                }
            }
        }

        public bool InBounds(int rowIndex, int columnIndex)
        {
            return rowIndex
        }
         */
        public Minefield ExploreNeighbors(Coordinates coordinates)
        {
            return this;
        }
Exemplo n.º 3
0
 private IList<bool> ExploreRow(int rowIndex, Coordinates coordinates)
 {
     if (rowIndex == coordinates.RowIndex)
     {
         return Enumerable.Range(0, _width)
             .Select(columnIndex => (coordinates.ColumnIndex == columnIndex)? true: _isExplored[rowIndex][columnIndex])
             .ToList();
     }
     else
     {
         return _isExplored[rowIndex];
     }
 }
Exemplo n.º 4
0
        /*
         *
         * public int GetBombsInRange(Coordinates coordinate)
         * {
         *  int counter = 0;
         *  for (int rowCounter = -1; rowCounter <= 1; rowCounter++)
         *  {
         *      for (int columnCounter = -1; columnCounter <= 1; columnCounter++)
         *      {
         *          //check for valid index
         *          if (InBounds(coordinate.RowIndex + rowCounter,
         *              coordinate.ColumnIndex + columnCounter))
         *          {
         *
         *          }
         *      }
         *  }
         * }
         *
         * public bool InBounds(int rowIndex, int columnIndex)
         * {
         *  return rowIndex
         * }
         */

        public Minefield ExploreNeighbors(Coordinates coordinates)
        {
            return(this);
        }