N-Puzzle

This is the manual for N-Puzzle version 1.2.1, released on August 18th 2013.

  1. Introduction
  2. Playing the game
  3. Game preferences
  4. Technical information
  5. Licenses
  6. Contacting the author

Introduction

N-Puzzle is an implementation of the classic fifteen-block sliding puzzle game which pretty much everyone has played at some point in their life. But unlike the traditional wooden or plastic puzzle, the computer version is not limited to a standard 4x4 board. You can play with arbitrarily sized board, from simple 3x3 to, for example, gigantic 8x8 board. Want to play a strange 5x7 board? Not a problem!

When starting a new game, the board is scrambled randomly 128 times. Each generated board is solvable (the board is solved internally in memory and if the board is detected to be unsolvable, new board is generated; this continues until a solvable board has been generated). Because the blocks are moved randomly during the board generation, some rows and columns can get moved more than once, and thus each generated board should be solvable in less than 128 moves. Of course, finding the exact sequence of which blocks to move and where... well that's what you have to do :-) !

The colors and sizes and block font can be freely changed from the Preferences and initially N-Puzzle takes the colors from your system settings.

For more information about the game itself and it's history, Wikipedia has a nice article of it.

Goal of the game

In case you've never played this game, I'll explain the rules quickly. The ultimate goal of this game is to put the blocks in sequential order, starting from 1 which is placed in the upper left corner. From there the pieces go to right, then on to next row and so on, in increasing order. One of the blocks in the game board is empty and you can reorder the blocks by moving them either one-by-one, or by entire rows and columns. When the blocks are in order and the empty block is located in the lower right corner, the game has been completed.

Unsolved game

An unsolved puzzle

Solved game

Now it's solved and it took me 119 moves

N-Puzzle counts your moves and shows them in the status bar. The move count does not have any significant meaning, because each board is randomized and thus no high score table can be kept. It's there just to remind you how long you've been jumbling the blocks :-)

Where's the highscore table?

Because the board is randomly scrambled, there is an inherent problem with the game: no score table can be kept. Because sometimes some blocks are moved twice (first in one direction, then back at a later time), not all scramblings can be considered "fair". The move count displayed is only for your own reference. Don't try to keep logs, games cannot be really compared. I have solved a 4x4 board in a mere 47 moves, but it is impossible to know how the board was internally scrambled, so it has no real meaning.

Of course, because each board is randomly generated, one can argue that they all are fair. But what if the random number function returns a sequence that causes only one row/column to be flip-flopped back and forth 127 times? Then the player can solve the game with one move. I would not consider that as "fair" even if it would be 100% equally random as any other board.

That is why there is no score table.

Playing the game

When you start N-Puzzle, it generates a new game instantly so you can just start playing it. New game can be generated at any time by choosing Game/New. If a game is in progress (that is, you have actually moved some blocks), a confirmation is asked first before a new game is created.

Moving the blocks

To move a block, simply click it. If the adjacent block is empty, the block you clicked is moved into that empty position. The empty block is then moved to occupy the space where the clicked block was. If no empty blocks are found from the surrounding blocks, then nothing happens.

To speed up the game (and reduce number of moves) you can move entire rows and columns by simply clicking them from where you want to move them. When moving rows you have to click in the same column where the empty block is and when moving columns you have to click on same row as the empty block.

There is no "undo move" command in N-Puzzle. The only way to undo a move is by manually moving the blocks back to where they were. And yes, this counts as a move. Don't make unnecessary moves.

Board size

The new game is always created at the selected size. By default it is set to 4x4, but from the Game/Board Size menu you can change the size. The menu lists the default sizes (3x3, 4x4, 8x8) and allows you to input a custom board size. The width and height of the board must be between 3 and 8, but it does not have to be square. A 3x5 board works just fine.

N-Puzzle remembers the last board size so you don't have to constantly re-set it.

Game preferences

If you press F5 or choose Game/Preferences, you get the Preferences dialog. From there you can change the font used in tiles and tile sizes and colors.

You can't actually set the tile size directly, because it is computed from the selected font's size. But you can change the amount of padding between tiles and the padding between board edges and the tiles.

The "Tile size tweak" field is used to scale everything larger/smaller. So if you just can't get the game board big enough (or small enough) use this. Value of 1.0 keeps everything intact, values <1.0 scales stuff down and values >1.0 scales everything up.

To change board colors, select the color you want and click on "Choose". Initially, N-Puzzle takes the colors from your system settings (for example, the board background color is set to your desktop color). Starting from version 1.1, N-Puzzle comes with predefined color sets. You can't directly add new sets as they are hardcoded but if you create a new good color set, just send it to me and I will add it to the game code. Note that selecting a color preset from the menu will override your current settings.

WARNING: Setting the tile size too big can cause the board to spill beyond the edges of your screen and (in the worst case) covers your task bar and other programs completely. In this case, there are two ways out:

  1. Press F5 to open the Preferences dialog and choose a smaller font or adjust the padding/size tweaks.
  2. Press Ctrl+Space to open the system menu, select "Move" then use arrow keys to move the window so you can see the menu bar. Press Enter to end the moving. Then you can select Game/Preferences and adjust font sizes/paddings/tweakings until the board fits on the screen again.

Technical information

System Requirements

N-Puzzle is a simple game with very low system requirements. It should work out-of-the-box under any Windows since 2000. No fancy features like sounds or hardware acceleration is used. N-Puzzle uses just plain Windows GDI to draw everything. It should work in pretty much any computer that is able to run Windows. Internally, N-Puzzle is a Unicode application, so it wants a Windows that supports Unicode.

Installing and uninstalling N-Puzzle

N-Puzzle, like many other projects the game's author has done, does not come with any installer or uninstaller. You have to install it yourself, but in the case of N-Puzzle, installation is extremely simple:

  1. Extract the files in the ZIP into any directory you want. You need to have write access to that directory, so if you use Windows Vista (my condolences) or 7, don't put N-Puzzle in the Program Files directory.
  2. (Optional) Create a shortcut icon for NPUZZLE.EXE.

To uninstall game, simply remove its directory. Nothing else needs to be done. N-Puzzle saves it's configuration data to file named NPUZZLE.CFG and it is placed to same file where NPUZZLE.EXE is. No other files are created anywhere and Windows registry is not used in any way.

Making N-Puzzle portable

Yes, N-Puzzle can be made fully portable. This means you can install it on your USB stick. You can even run it directly from a read-only media, like CD or DVD.

N-Puzzle itself is already portable. Just copy the NPUZZLE.EXE and NPUZZLE.CFG to anywhere you want and that's it. You can, of course, include this manual (and images) if you want but they're not required.

Normally N-Puzzle saves its settings each time you quit it. Because USB sticks have limited write cycles and CD/DVD discs are read-only, you'll want to eliminate this. To prevent N-Puzzle from saving its settings, place a file named dont-save-options in the same directory with NPUZZLE.EXE. The contents and size of that file does not matter, just that it exists is enough. When N-Puzzle sees that file, it does not save the settings. So before creating that file, first configure N-Puzzle for your needs!

Licenses

Program license

N-Puzzle is distributed under the GNU GPL version 2. If the previous link does not work, try this: http://www.gnu.org/licenses/gpl-2.0.txt.

Manual license

This manual is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license.

Contacting the author

If you have anything to say about N-Puzzle, let it be bug reports, flames, new ideas, etc. don't hesitate to contact me. You can find my email address on my homepage. Because I change the address every now and then, I can't put it in a manual like this.

New versions of N-Puzzle and other projects made by me are also available from that address.

Have fun!

Regards, Jarmo