MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / assign

Function assign

data_structures/arrays/sudoku_solver.py:86–95  ·  view source on GitHub ↗

Eliminate all the other values (except d) from values[s] and propagate. Return values, except return False if a contradiction is detected.

(values, s, d)

Source from the content-addressed store, hash-verified

84
85
86def assign(values, s, d):
87 """
88 Eliminate all the other values (except d) from values[s] and propagate.
89 Return values, except return False if a contradiction is detected.
90 """
91 other_values = values[s].replace(d, "")
92 if all(eliminate(values, s, d2) for d2 in other_values):
93 return values
94 else:
95 return False
96
97
98def eliminate(values, s, d):

Callers 4

parse_gridFunction · 0.85
eliminateFunction · 0.85
searchFunction · 0.85
random_puzzleFunction · 0.85

Calls 1

eliminateFunction · 0.85

Tested by

no test coverage detected