Ejemplo n.º 1
0
        /// <summary>
        /// Return all cells that are near a cell with 3 fish
        /// </summary>
        /// <param name="board"></param>
        /// <param name="origin"></param>
        /// <returns></returns>
        public static IList <Cell> GetAvailableCellsAroundA3FishCell(this Cell[,] board)
        {
            var result = new List <Cell>();

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (board[i, j].CellType == CellType.Fish && board[i, j].FishCount == 3)
                    {
                        result.AddRange(board.GetNearCells(board[i, j]));
                    }
                }
            }

            return(result.Where(e => e.FishCount != 3).ToList());
        }