rendered paste bodypublic class ForcedFieldConstraintSolver implements ConstraintSolver { public boolean solveConstraints(State s) throws NotSolvableException { // iteratre over the structures for (Structure structType : Structure.values()) { for (int structId = 0; structId < NUMBERS; structId++) { // iterate over the possible numbers for (int i = 1; i < NUMBERS + 1; i++) { for (int pos = 0; pos < NUMBERS; pos++) { int lastPossiblePosition = -1; int foundCount = 0; if (s.isPossibleAt(structType, structId, pos, i)) { lastPossiblePosition = i; foundCount++; } if (foundCount == 1) { s.setValue(structType, structId, lastPossiblePosition, i); return true; } } } } } return false; } static final int NUMBERS = 9;}