Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: The 15 Puzzle

by Eily (Monsignor)
on Jun 11, 2020 at 12:23 UTC ( #11117940=note: print w/replies, xml ) Need Help??


in reply to The 15 Puzzle

++ For your code. It's quite readable as well despite being dense IMHO.

About the number of permutations, rather than a loop wouldn't it be simpler to just have: @board[1,2] = @board[2,1] if $inversions %2; ?

Replies are listed 'Best First'.
Re^2: The 15 Puzzle
by msh210 (Monk) on Jun 14, 2020 at 08:37 UTC

    Good idea; thanks!

    $_="msh210";$"=$\;@_=@{[split//,uc]}[2,0];$_="@_$\1";$\=$/;++$_[0]for$...1;print lc substr crypt($_,"@_"),1,6

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-03-26 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?