in reply to Re: The 15 Puzzle
in thread The 15 Puzzle
Thanks.
Note that not all configurations of the puzzle are solvable. My check for $inversions % 2 == 0 makes sure we get a solvable configuration. I don't see anything comparable in your code, though it could be I'm just not seeing it.
$_="msh210";$"=$\;@_=@{[split//,uc]}[2,0];$_="@_$\1";$\=$/;++$_[0]for$...1;print lc substr crypt($_,"@_"),1,6
In Section
Cool Uses for Perl