#####\ ####\ ####\ #####\ ####\ ##\ ##\ ####\ ##\ ##\ ##\ ##\ ##\##\ ##\ ###\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ####\##\ ##\ #\ ##\ ##\ ##\ ##\ ##\ ##\ #######\ ##\ ###\ ##\ ##\ ##\ ##\ ##\ ##\####\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ###\ ##\####\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ #\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\ ##\##\ ##\ ##\ ##\ ##\ ##\ #####\ #######\ ####\ #####\ ####\ ##\ ##\ ###\#\ SOLUTION OF SLIDING-PIECE PUZZLES Release 6.0 Copyright (c) 2008, 2022 Balmoral Software. All Rights Reserved. Contents 1. Introduction 2. Installing the Program 3. Running the Program 4. Tutorial 5. Optional Solution File 6. Alternate Keys 7. Command-Line Mode 8. Revision History 9. Disclaimer 1. Introduction ************************************************************** If you've ever gotten stuck solving a sliding-piece puzzle, then the freeware SLIDING program is for you! It provides solutions for de-scrambling rectangular puzzle layouts, and runs in a Command Prompt under Windows. All layouts assume numbered pieces of equal size with one like-sized space. Solutions can be provided for layouts up to 6 x 6 (25 different layout arrangements). 2. Installing the Program **************************************************** To install the SLIDING program under Windows, simply run the downloaded SlidingSetup.exe program. The installation program will provide step-by-step instructions on the screen. 3. Running the Program ******************************************************* To run the SLIDING program, use the desktop icon or the Sliding folder in the Start menu. Once puzzle dimensions are specified, the SLIDING program displays a puzzle grid and the puzzle definition mode begins. Keyboard arrow keys or the [Enter] key can be used to position a red double-walled cursor in the puzzle grids to define the starting and ending arrangements of the puzzle. Either numeric keys or the PgUp and PgDn keys can be used to change puzzle piece values. To use a numeric keypad, be sure to set the NumLock key on. Use the spacebar, Delete or Backspace keys to erase an entry or to define the single open space in the puzzle. If the starting and/or ending arrangement of your puzzle is almost completely in order, you can save time specifying piece values by filling the entire grid with sequential numbers using the # key. Use the [Tab] key to switch the cursor between the starting and ending arrangements of the puzzle. Press the equals = key to allow the program to solve the puzzle. Before the actual solution sequence is started, the puzzle arrangement that you specified is checked for missing pieces and parity errors. In sliding-piece puzzles of this type, a "parity law" states that some configurations are impossible to solve, and the SLIDING program applies a parity test to identify these unsolvable arrangements. For example, it's impossible to switch the positions of only two pieces, leaving all the other pieces unchanged. In the solution display mode, the keyboard [Enter] key may be used to proceed through the solution sequence. At each step, the puzzle grid cursor indicates the piece you should move into the empty space. You can terminate the solution display process at any time by pressing the [Esc] key. After the solution display is complete, or if you terminated with [Esc], you can optionally specify a text file into which the completed puzzle solution will be saved. For more details on the output solution file, see Section 5 below. If your particular puzzle contains an image rather than numbers, it helps to visualize the finished image and make a numbered list of each piece and its description. 4. Tutorial ****************************************************************** In this section, we'll run through a sample puzzle solution. We'll specify a simple but solvable jumbling for the SLIDING program to put back in order. Start up the SLIDING program, specifying a puzzle with 3 rows and 3 columns. The following puzzle definition display will then be shown: ======================= SLIDING PIECE PUZZLE SOLUTION ======================= Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved Starting Arrangement Ending Arrangement * * *---+---+ +---+---+---+ * * | | | 1 | 2 | 3 | * * *---+---+ +---+---+---+ | | | | +---------------------+ | 4 | 5 | 6 | +---+---+---+ | PUZZLE | +---+---+---+ | | | | | DEFINITION | | 7 | 8 | | +---+---+---+ +---------------------+ +---+---+---+ ^ v <- ->: Move red cursor 1-9: Specify piece's numerical value Tab: Switch red cursor Spacebar: Define space in grid between grids PgUp PgDn: Change piece's value #: Fill grid in sequence =: Begin solving puzzle !: Clear grid Esc: Quit Begin by pressing the # (Shift+3) key to load ordered starting values. With the red double-walled cursor in the upper-left corner of the starting puzzle grid, use the key sequence PgUp, right arrow, PgDn to change the top row to 2 1 3. Press the right-arrow key once to move the cursor to the upper-right corner of the starting puzzle grid, then press the spacebar to define the open space in that position. Press the down arrow key twice to move the cursor to the lower- right corner of the grid, then press the 3 key on the keyboard to complete the jumbling of the puzzle. In this simple example, we'll assume that the target puzzle arrangement is to be with the pieces in numerical order and the space at lower right, as indicated in the ending arrangement above. In general, however, any configuration of the space and puzzle pieces can be specified for the ending arrangement by using the Tab key to move the cursor to the ending arrangement grid and making edits there. If such a puzzle does not fail the parity test, the SLIDING program will find its solution. We have now completed the puzzle definition for our tutorial example: ======================= SLIDING PIECE PUZZLE SOLUTION ======================= Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved Starting Arrangement Ending Arrangement +---+---+---+ +---+---+---+ | 2 | 1 | | | 1 | 2 | 3 | +---+---+---+ +---+---+---+ | 4 | 5 | 6 | +---------------------+ | 4 | 5 | 6 | +---+---* * * | PUZZLE | +---+---+---+ | 7 | 8 * 3 * | DEFINITION | | 7 | 8 | | +---+---* * * +---------------------+ +---+---+---+ ^ v <- ->: Move red cursor 1-9: Specify piece's numerical value Tab: Switch red cursor Spacebar: Define space in grid between grids PgUp PgDn: Change piece's value #: Fill grid in sequence =: Begin solving puzzle !: Clear grid Esc: Quit Press the keyboard equals = key to start solving the puzzle. The SLIDING program computes the number of moves required, then displays the moves one at a time, updating the left grid at each move so you can check your progress against your actual puzzle. In this example, 22 moves are required for a complete solution. The first one involves moving the piece marked 1 at top center into the space to its right: ======================= SLIDING PIECE PUZZLE SOLUTION ======================= Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved Current Puzzle Ending Arrangement +---* * *---+ +---+---+---+ | 2 * 1 * | | 1 | 2 | 3 | +---* * *---+ +---+---+---+ | 4 | 5 | 6 | +---------------------+ | 4 | 5 | 6 | +---+---+---+ | Move 1 of 22 | +---+---+---+ | 7 | 8 | 3 | | | | 7 | 8 | | +---+---+---+ +---------------------+ +---+---+---+ Enter: Next move Esc: Quit and optionally save Press the [Enter] key to step through the individual moves. Midway through the solution sequence, pieces are converging on their desired positions. The tenth move involves moving the piece marked 4 downwards: ======================= SLIDING PIECE PUZZLE SOLUTION ======================= Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved Current Puzzle Ending Arrangement *-*-*---+---+ +---+---+---+ * 4 * 1 | 6 | | 1 | 2 | 3 | * * *---+---+ +---+---+---+ | | 5 | 2 | +---------------------+ | 4 | 5 | 6 | +---+---+---+ | Move 10 of 22 | +---+---+---+ | 7 | 8 | 3 | | | | 7 | 8 | | +---+---+---+ +---------------------+ +---+---+---+ Enter: Next move Esc: Quit and optionally save When all 22 moves have been made, the puzzle is solved: ======================= SLIDING PIECE PUZZLE SOLUTION ======================= Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved Current Puzzle Ending Arrangement +---+---+---+ +---+---+---+ | 1 | 2 | 3 | | 1 | 2 | 3 | +---+---+---+ +---+---+---+ | 4 | 5 | 6 | +---------------------+ | 4 | 5 | 6 | +---+---+---+ | PUZZLE | +---+---+---+ | 7 | 8 | | | SOLVED! | | 7 | 8 | | +---+---+---+ +---------------------+ +---+---+---+ Enter: Next move Esc: Quit and optionally save Enter a name for the output solution file, or press [Enter] to quit without saving: 5. Optional Solution File **************************************************** If a puzzle solution output file is specified, the SLIDING program writes the complete solution to the file. The output file is written to the SLIDING installation directory (C:\Program Files\SLIDING\ by default), unless a different path is specified as part of the output filename. The output file includes a solution sequence using moves relative to the current position of the space (often the easiest to use with physical puzzles), as well as a solution sequence in terms of absolute piece positions. Here is the output file corresponding to the example puzzle in the above tutorial: =============== SLIDING PIECE PUZZLE SOLUTION =============== Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved File: EXAMPLE.TXT Starting arrangement Ending arrangement +---+---+---+ +---+---+---+ | 2 | 1 | | | 1 | 2 | 3 | +---+---+---+ +---+---+---+ | 4 | 5 | 6 | | 4 | 5 | 6 | +---+---+---+ +---+---+---+ | 7 | 8 | 3 | | 7 | 8 | | +---+---+---+ +---+---+---+ 22-move solution relative to current position of space (L: Left, R: Right, A: Above, B: Below): L L B R A R B L L A R R B B L A A R B L B R +---+---+---+ | A | B | C | +---+---+---+ | D | E | F | +---+---+---+ | G | H | I | +---+---+---+ 22-move solution in terms of absolute piece locations: B A D E B C F E D A B C F I H E B C F E H I 6. Alternate Keys ************************************************************ On laptop or nonstandard keyboards, alternate keys may be used for the SLIDING program controls: Standard Key Alternate Key Function PgUp > Increase grid cell value PgDn < Decrease grid cell value Up arrow U Move red cursor upward Down arrow D Move red cursor downward Left arrow L Move red cursor to the left Right arrow R Move red cursor to the right 7. Command-Line Mode ********************************************************* The SLIDING program has optional command-line parameters that make it possible to solve puzzles without any keyboard interaction, if desired. Command-line parameters may be specified in the Cmd line or Target field of the Program tab of the Windows icon Properties. If you think you'll need to run the program multiple times, it's probably easier to open a Command Prompt window with Start | Run | CMD. In the Command Prompt window, change your directory to the Sliding installation directory by entering the command C: and then entering the command CD "\Program Files\SLIDING". You can then easily run the SLIDING program as many times as you'd like from the command prompt. The command-line syntax is SLIDING [height width [inputfile outputfile]] where the brackets indicate optional command-line parameters. Either zero, two or four parameters may be specified on the command line following SLIDING. If no command-line parameters are specified, the program is run in normal interactive mode. The initial queries about the puzzle height and width will be skipped if they are specified as the first two command-line parameters (assuming they are within the valid range). If all four command-line parameters are specified, the puzzle is solved non-interactively using a puzzle definition specified in the inputfile parameter. The puzzle output file is the same as that generated interactively. If a puzzle input file is specified, it must be created as an ordinary text file using the following syntax: First row of starting arrangement Second row of starting arrangement ... Last row of starting arrangement First row of ending arrangement Second row of ending arrangement ... Last row of ending arrangement A blank line separates the starting and ending arrangements. Each row consists of the digits of the puzzle arrangement, equivalent to what is shown in the interactive puzzle solution screen, without the surrounding grid. Digits are separated by one or more spaces for readability. Only digits and spaces should appear in each row of the puzzle definition. The location of the space in the starting and ending arrangements must be indicated in the puzzle input file by 0 (zero). A puzzle input file may be created using any plain-text (unformatted) editor, such as Windows Notepad. For example, suppose the text file INPUT.TXT consists of the following seven lines: 1 2 3 4 5 6 8 7 0 1 4 7 2 5 8 3 6 0 Running the command line SLIDING 3 3 INPUT.TXT OUTPUT.TXT creates the 32-move puzzle solution file OUTPUT.TXT: =============== SLIDING PIECE PUZZLE SOLUTION =============== Release 6.0 Copyright (c) 2008 Balmoral Software All Rights Reserved File: OUTPUT.TXT Starting arrangement Ending arrangement +---+---+---+ +---+---+---+ | 1 | 2 | 3 | | 1 | 4 | 7 | +---+---+---+ +---+---+---+ | 4 | 5 | 6 | | 2 | 5 | 8 | +---+---+---+ +---+---+---+ | 8 | 7 | | | 3 | 6 | | +---+---+---+ +---+---+---+ 32-move solution relative to current position of space (L: Left, R: Right, A: Above, B: Below): A A L B R B L A L B R R A L L A R R B L B R A L A L B R A R B B +---+---+---+ | A | B | C | +---+---+---+ | D | E | F | +---+---+---+ | G | H | I | +---+---+---+ 32-move solution in terms of absolute piece locations: F C B E F I H E D G H I F E D A B C F E H I F E B A D E B C F I This solution is generated without any keyboard interaction. If a large number of predefined puzzles are to be solved, the SLIDING command-line mode is suitable for inclusion in batch files. 8. Revision History ********************************************************** Version 6.0 (September 2008) Shorter puzzle solutions All puzzles sizes up to 6 x 6 Improved user interface for puzzle entry Non-interactive (command-line) mode Release 4.1 (April 2000) Windows installation package Always query for optional solution file Release 4.0 (November 1999) Any starting and ending puzzle configuration Shorter puzzle solutions Optional solution file on command line Digit keys in interface Release 3.1 (July 1999) Improved parity-checking algorithm Release 3.0 (June 1998) Direct-access support data file ANSI.SYS requirement removed Puzzle pre-load feature Revised interface Release 2.0 (October 1997) Support data imbedded in executable All puzzles up to 5 x 5 Alternate input keys Release 1.0 (May 1996) Initial release Separate support data files Puzzles limited to four configurations up to 4 x 4 9. Disclaimer *************************************************************** The SLIDING freeware program from Balmoral Software (the "Software") is provided "as is" and "with all faults." Balmoral Software makes no representations or warranties of any kind concerning the quality, safety or suitability of the Software, either express or implied, including without limitation any implied warranties of merchantability, fitness for a particular purpose, or non-infringement. Neither Balmoral Software nor anyone else who has been involved in the creation, production, or delivery of this Software shall be liable for any indirect, consequential, or incidental damages arising out of the use or inability to use such Software even if Balmoral Software has been advised of the possibility of such damages or claims. The person using the Software bears all risk as to the quality and performance of the Software. Copyright (c) 2008, 2022 Balmoral Software. All Rights Reserved.