Created
October 1, 2023 21:05
-
-
Save hwayne/951a8c148f6f26fb23fbe892442be28b to your computer and use it in GitHub Desktop.
Sum finder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import planner. | |
main => | |
S0 = {22, 0, [6, 6, 9, 5, 9, 1, 10, 9, 9, 3]}, | |
plan(S0, Plan), | |
nl, | |
writeln(Plan), | |
nl. | |
final({Target, Current, _}) => | |
Target = Current. | |
action(S0, S1, Action, ActionCost) => | |
Action = {add, X, Next}, | |
ActionCost = 1, | |
S0 = {Target, Current, L}, | |
member(X, L), | |
Next = Current + X, | |
not member(Next, [12, 21]), | |
S1 = {Target, Next, delete(L, X)}, | |
true. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment