def forward_checking(csp, var, value, assignment, removals):
for B in csp.neighbors[var]:<EOL><INDENT>if B not in assignment:<EOL><INDENT>for b in csp.curr_domains[B][:]:<EOL><INDENT>if not csp.constraints(var, value, B, b):<EOL><INDENT>csp.prune(B, b, removals)<EOL><DEDENT><DEDENT>if not csp.curr_domains[B]:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>return True<EOL>
Prune neighbor values inconsistent with var=value.