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