http://qs321.pair.com?node_id=11117898


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

Replies are listed 'Best First'.
Re^3: The 15 Puzzle
by afoken (Chancellor) on Jun 10, 2020 at 12:35 UTC
    not all configurations of the puzzle are solvable

    This Numberphile video explains the math behind.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)