Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Thanked 0 Times in 0 Posts

    help with 15 piece puzzle please


    hi so i am working on a group project for my CS class to build a 15 piece puzzle in javascript. The other group member wrote up some code which i dont understand he is unwilling to comment, so now i have to try and find moveable pieces but i have no idea how to go about it. His shuffling algorithm works perfectly well but seems uncomprehensible to me. Please help. I have posted the JS code on pastebin. Thanks

  • #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Behind the Wall
    Thanked 345 Times in 341 Posts
    the code shown is basically a way (though not very efficient) to scramble the tiles without repetition. but that still doesn’t prevent half of the configurations to be unsolvable.

    you might look at http://bytes.kulturbeutel-leipzig.net/MagicSquare.xhtml for inspiration, there’s some more explanation.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts