A study in JavaScriptJavaScript is the premier programming language for dynamic Web and mobile content. The little game to the right is a whimsical example of the power of this ubiquitous language. Let us help you make your web site more dynamic ! How to playClick "Shuffle", then solve the puzzle by moving the tiles until the board is back in order. To move a tile, click on it. Only tiles adjacent to the blank space can be moved. Try to solve the puzzle in fewer than the number of shuffles. By how much can you decrease the number of shuffles before the game becomes trivial? is there a number of shuffles beyond which the game's difficulty doesn't increase? Solving the puzzleYou control the puzzle's difficulty by the number of individual movements, or "shuffles", to apply to the tiles at the start of the game. The default number of shuffles is 22. That does not sound like many, but you may find most puzzles produced by 22 shuffles to be difficult enough. You can change the number in the "Shuffles" box until you click the "Shuffle" button; after that the number is locked until the puzzle is solved again. You can set the number of shuffles to any positive whole number. Depending on your computer's speed and the browser you are using, your system can become unresponsive if you ask for a large enough shuffle. You can also use the puzzle manually. Move the tiles to your own starting position, and then solve the puzzle. If you do it this way, you'll have to count your shuffles and moves yourself. You can affect the shuffle somewhat by manually moving the tiles to a position of your choosing before clicking the "Shuffle" button. But the shuffle is still pseudorandom, so the starting position doesn't actually have much influence. If you do it this way, the manual moves that you made are not reflected in the shuffle count. And unless you click "Shuffle", you won't get a congratulatory message when you solve the puzzle. More about the puzzleBeginning around 1880, American gamesmaker, chessmaster and "practical mathematician" Sam Loyd sold thousands of these now-famous sliding-tile puzzles. Selling the games with all the tiles in numerical order except the last two, wily Sam promised a prize of $1000 to anyone who could restore all 15 tiles to a simple ascending sequence, left to right, top to bottom. Many claimed to have solved the puzzle, but Sam's company always refused to pay, stating - correctly - that someone had tampered with the paydirt puzzle. Sam knew that there are two "families" of tile arrangements, and there is no way to change "families" merely by sliding tiles .. the tiles have to be removed from their frames to perform the necessary rearrangement. By reversing tiles 14 and 15, Sam ensured that those puzzles had no solution to the problem as stated .. and the prize money he offered remained secure. Sam didn't invent the puzzle; he was, after all, a practical mathematician. Try it yourselfOur implementation of the well-known puzzle always presents a solvable arrangement. Full instructions are in the 'How to Play' section of this page. More about the softwareMGT Computer Solutions developed this JavaScript implementation of the Loyd-15 Puzzle to demonstrate the power of JavaScript in programming modern browsers. Our Loyd-15 Puzzle Game is based on a design developed by our company's founder in 1978, and first implemented on the 6502 chip of the Ohio Scientific C-III. It has since been ported to many platforms and refactored to use object-oriented methodology. |
Any trademark appearing on this page is the property of its owner. Please send us your questions or comments about this web site. |