Minimal steps down to 1: Difference between revisions

m
Line 239:
end
if verbose
print("Therel are ",= length(solutions), " solutions for path of length ",
print("There ", l > numsteps,1 ? " fromare $startl tosolutions" $goal.\nExample: ")is $l solution",
" for path of length ", numsteps, " from $start to $goal.\nExample: ")
for step in solutions[1]
print(step, step.out == 1 ? "\n\n" : ", ")
Line 288 ⟶ 289:
Example: divide 2 yields 1
 
There areis 1 solutionssolution for path of length 1 from 3 to 1.
Example: divide 3 yields 1
 
Line 306 ⟶ 307:
Example: divide 2 yields 4, divide 2 yields 2, divide 2 yields 1
 
There areis 1 solutionssolution for path of length 2 from 9 to 1.
Example: divide 3 yields 3, divide 3 yields 1
 
There areis 1 solutionssolution for path of length 3 from 10 to 1.
Example: subtract 1 yields 9, divide 3 yields 3, divide 3 yields 1
 
Line 319 ⟶ 320:
For start of 1, no steps needed.
 
There areis 1 solutionssolution for path of length 1 from 2 to 1.
Example: divide 2 yields 1
 
4,107

edits