Compare commits
7 commits
4f44c80c38
...
6a6552f6fc
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 6a6552f6fc | ||
Bruno BELANYI | a6560adc6a | ||
Bruno BELANYI | 709ad10ae2 | ||
Bruno BELANYI | 5266bd7cd7 | ||
Bruno BELANYI | 068ce3366a | ||
Bruno BELANYI | a8b2046162 | ||
Bruno BELANYI | 84ee4c57f0 |
|
@ -92,13 +92,12 @@ def solve(input: List[str]) -> int:
|
|||
|
||||
solver.add(registers["z"] == zero)
|
||||
|
||||
digits_to_num = lambda digits: functools.reduce(lambda a, b: a * 10 + b, digits)
|
||||
model_number = functools.reduce(lambda a, b: a * 10 + b, digits)
|
||||
|
||||
solver.maximize(digits_to_num(digits))
|
||||
solver.maximize(model_number)
|
||||
assert solver.check() == z3.sat # Sanity check
|
||||
|
||||
model = solver.model()
|
||||
return digits_to_num(model[d].as_long() for d in digits)
|
||||
return solver.model().eval(model_number)
|
||||
|
||||
return run_z3(parse())
|
||||
|
||||
|
|
|
@ -92,13 +92,12 @@ def solve(input: List[str]) -> int:
|
|||
|
||||
solver.add(registers["z"] == zero)
|
||||
|
||||
digits_to_num = lambda digits: functools.reduce(lambda a, b: a * 10 + b, digits)
|
||||
model_number = functools.reduce(lambda a, b: a * 10 + b, digits)
|
||||
|
||||
solver.minimize(digits_to_num(digits))
|
||||
solver.minimize(model_number)
|
||||
assert solver.check() == z3.sat # Sanity check
|
||||
|
||||
model = solver.model()
|
||||
return digits_to_num(model[d].as_long() for d in digits)
|
||||
return solver.model().eval(model_number)
|
||||
|
||||
return run_z3(parse())
|
||||
|
||||
|
|
Loading…
Reference in a new issue