printGrid function

void printGrid(
  1. Grid grid
)

Used for debugging grid, prints to console a somewhat-grid-shaped matrix of cell value

Implementation

void printGrid(Grid grid) {
  for (int r = 0; r < 9; r++) {
    String row = "";
    for (Cell c in grid.getRow(r)) {
      row += ((c.getValue() == 0) ? " " : c.getValue()).toString() + " ";
    }
    print(row);
  }
}