public void getSolution(BTSolver solver) { String retStr = "("; SudokuFile solnBoard = solver.getSolution(); int[][] sfBoard = solnBoard.getBoard(); if (solver.hasSolution()) { for (int i = 0; i < solnBoard.getN(); i++) { for (int j = 0; j < solnBoard.getN(); j++) { retStr += (Integer.toString(sfBoard[j][i]) + ", "); } } } else { for (int i = 0; i < solnBoard.getN(); i++) { for (int j = 0; j < solnBoard.getN() - 1; j++) { retStr += ("0, "); } } } retStr = retStr.substring(0, retStr.length() - 2); retStr += ")"; this.solution = retStr; }
public void getNodesDeadEnds(BTSolver solver) { this.numAssignments = solver.getNumAssignments(); this.deadEnds = solver.getNumBacktracks(); }