class Grid{ public final int size; Cell[] cells; Cell[][] rows; Cell[][] cols; Cell[][] squares; // Constructs a 9x9 grid public Grid(){ this(9); } // Constructs a size x size grid public Grid(int size){ this.size = size; cells = new Cell[size * size]; // Allocate subsets rows = new Cell[size][size]; cols = new Cell[size][size]; squares = new Cell[size][size]; // Initialize the cells for(int i=0; i