public World(int width, int height, ReprConstructor <R> rconstructor) { this.width = width; this.height = height; this.cells = new CompoundCells <R>(); this.cells.cells = new Cell[height][]; this.cells.reprs = new R[height][]; for (int y_pos = 0; y_pos < height; y_pos++) { var cells_line = new Cell[width]; var reprs_line = new R[width]; for (int x_pos = 0; x_pos < width; x_pos++) { var cell = new Cell(x: x_pos, y: y_pos, current_state: CellState.Dead); var cell_repr = rconstructor(cell); cells_line[x_pos] = cell; reprs_line[x_pos] = cell_repr; } this.cells.cells[y_pos] = cells_line; this.cells.reprs[y_pos] = reprs_line; } }
public GOLRunner(int width, int height, ReprConstructor <R> rconstructor) { world = new World <R>(width, height, rconstructor); }