これは、可能な限り少ないステップで数字パズルを解くための単純なキューベースのアプローチです。
python solver.py 1 2 3 4 10 25 --target 81
(6つの数字は破線の円で概説されている6つの数字、81は到達しようとしている大きな数字です) $ python3 solver.py 5 11 19 20 23 25 -t 413
Found a solution in 4 steps. Run with --spoil to see the details.
$ python3 solver.py 5 11 19 20 23 25 -t 413 --spoil
Found a solution in 4 steps:
20 ➖ 11 ? 9
23 ➕ 25 ? 48
9 ✖️ 48 ? 432
432 ➖ 19 ? 413
test_solver.py
で最小限のテストがあります。 python -m unittest
あり、変更を加えた後に物事が機能するかどうかを確認してください。
Mastodonで私を見つけてください:https://takahe.social/@drew
PRSようこそ!