pigeon-magnet-solver/pigeon_magnet_solver/main.py

25 lines
471 B
Python
Raw Normal View History

2023-08-18 18:41:58 +00:00
#!/usr/bin/python3
from .board import Board
2023-08-30 00:57:05 +00:00
from .solver import solve
2023-08-18 18:41:58 +00:00
def main() -> None:
2023-08-30 00:57:05 +00:00
solution = solve(
Board.default_puzzle,
lambda state: state.solution_class == (3, 1, 2),
)
2023-08-18 22:35:10 +00:00
2023-08-30 00:57:05 +00:00
if solution is None:
print("Unsolvable!")
return
for btn, state in solution:
2023-08-18 22:57:46 +00:00
print(f"clicking button {btn} ...")
2023-08-30 00:57:05 +00:00
print(state)
print(state.solution_class, state.binary_repr)
2023-08-18 18:41:58 +00:00
if __name__ == "__main__":
main()