ai :: PuzzleProblem :: print_plan
# Print the plan with words.
fun print_plan(plan: Sequence[Int])
do
var s = new Array[String]
for i in plan do
if i == -1 then
s.add "right(>)"
else if i == 1 then
s.add "left(<)"
else if i == -width then
s.add "down(v)"
else if i == width then
s.add "up(^)"
else
abort
end
end
print "Solution in {plan.length} moves: {s.join(" ")}"
end
lib/ai/examples/puzzle.nit:183,2--201,4