A puzzle is solved if each unit is a permutation of the digits 1 to 9.
(values)
| 194 | |
| 195 | |
| 196 | def solved(values): |
| 197 | """ |
| 198 | A puzzle is solved if each unit is a permutation of the digits 1 to 9. |
| 199 | """ |
| 200 | |
| 201 | def unitsolved(unit): |
| 202 | return {values[s] for s in unit} == set(digits) |
| 203 | |
| 204 | return values is not False and all(unitsolved(unit) for unit in unitlist) |
| 205 | |
| 206 | |
| 207 | def from_file(filename, sep="\n"): |
no test coverage detected