deepClone function

Grid deepClone(
  1. Grid source

Performs a DEEP clone of a grid When talking about cloning, it (mostly) boils down to two types; Shallow: Constructs new object in new member space, but inserts references for as many of that objects fields as possible. Deep: Constructs a new object in new memory space, along with new objects for all fields within that object.


Grid deepClone(Grid source) {
  Grid _target = new Grid();

  for (int r = 0; r < 9; r++) {
    for (int c = 0; c < 9; c++) {
  return _target;