15 puzzle solver: Difference between revisions
m
→{{header|F_Sharp|F#}}
m (→The Solver) |
|||
Line 162:
}
let n = Seq.collect fN n
match (Seq.tryFind(fun(_,_,n,_,_)->n=
|Some(_,_,_,n,_) -> printf "Solution found with %d moves: " (List.length n); List.iter (string >> printf "%s") (List.rev n); printfn ""
|_ -> Solve (Seq.filter(fun (_,_,_,_,n)->not n) n)
Solve [(2,0,
</lang>
{{out}}
Line 172:
</pre>
see: [http://www.rosettacode.org/wiki/15_puzzle_solver/Optimal_solution Pretty Print of Optimal Soltion]
=={{header|Phix}}==
{{incorrect|Phix|The task calls for a solution in the fewest moves which is 52 not 58}}
|