Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: The 15 Puzzle

by msh210 (Monk)
on Jun 10, 2020 at 09:54 UTC ( #11117898=note: print w/replies, xml ) Need Help??


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 (Canon) 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". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11117898]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2020-09-19 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (114 votes). Check out past polls.

    Notices?