Example #1
0
        public Cell[] ColumnAt(int col)
        {
            if (col < 0 || col > TotalRows - 1)
                return null;

            Cell[] column = new Cell[TotalRows];

            for (int i = 0; i < TotalRows; i++)
                column[i] = Cells[i, col];

            return column;
        }
Example #2
0
        private bool FindLastOne(Puzzle puzzle, int r, int c, Cell[] searchMe)
        {
            var numDashes = searchMe.Where(cell => cell.Value == '-')
                                    .Count();
            if (numDashes == 1)
            {
                puzzle.Cells[r, c].Value = puzzle.CharacterSet.Except( searchMe.Select(cell => cell.Value) )
                                                              .Single();
                return true;
            }

            return false;
        }
Example #3
0
        public Cell[] RowAt(int r)
        {
            if (r< 0 || r > TotalRows - 1)
                return null;

            Cell[] row = new Cell[TotalRows];

            for (int i = 0; i < TotalRows; i++)
                row[i] = Cells[r, i];

            return row;
        }
Example #4
0
 private Cell[,] ConvertToCells(string[] rows)
 {
     Cell[,] cells = new Cell[rows.Length, rows.Length];
     for (int i = 0; i < rows.Length; i++)
         for (int j = 0; j < rows[i].Length; j++)
             cells[i,j] = new Cell(rows[i][j], i, j);
     return cells;
 }