Hashiwokakero or Bridges is a logic game published by Nikoli. The object of the game is to link a set of islands with bridges so that it is possible to reach any island from any other. As ever, there is a range of rules designed to make this difficult and interesting. The islands, represented by circles, are laid out on a rectangular grid and bridges can only follow the lines of the grid, vertically or horizontally. Bridges cannot cross. The circles representing the islands contain numbers which specify the number of bridges that must start from that island. A maximum of two bridges can be placed between any pair of islands. There is only one arrangement of bridges that will satisfy these criteria for each puzzle.
A bridge is placed using a left mouse click, and if later it is thought to be incorrect, it can be removed by a right mouse click. If the number bridges equals the specified number for the island the circle representing the island will change colour to light green. The game is finished when all islands are green. As with all PZL games no guessing is required as at every stage there is always a next logical move. PZL bridges contains 1500 puzzles and can also read and solve external puzzles.
A video from Bridges showing a simple puzzle being solved. The player tries to deduce which bridge can be added as the next logical step. She adds bridges with left mouse clicks. At one stage she is unsure if the last added bridge is correct and so clicks on the hand icon in the toolbar, which turns down and highlights the last bridge as being wrong. A further click removes the incorrect bridge. Later she resorts to using the hint button (the wand icon) to suggest the next move.
When the game starts a randomly selected puzzle will be loaded. Add bridges with left mouse clicks, remove them with the right mouse. Clicking the hand icon will cause the program to check for incorrectly placed bridges and to highlight any found. A further click on the hand will remove all incorrect bridges. If you get stuck, clicking on the wand icon will request a hint and the program will highlight an island to which a bridge can be added. If you cannot work out which direction the bridge should take, another click on the wand will cause the bridge to be placed. Clicking the sad smiley icon requests that the solution is shown.
The jigsaw icon contains a menu for configuring the game and for loading external puzzles. Clicking the icon to its right will load a randomly selected puzzle. The box to the right of the sad smiley contains the current puzzle number and can be used to select a puzzle by number or to reload the current puzzle (just hit "Enter"). The number to the right of the number box is the current puzzle's difficulty score. To its right is a clock. This clock display will be overwritten by the algorithm number if the hint option is selected. The game uses only 2 algorithms, numbered 0 and 1.
The game contains 3 blocks of puzzles with sizes 10x10, 12x12, 15x15, 500 of each, numbered sequentially from 0 to 1499. Within each block the puzzles are arranged in difficulty score order, easiest first.
As a solving aid the program can be configured to show thin lines which indicate the routes of possible bridges.
The program can also read external puzzles stored in text files in the format shown here. When an external puzzle is read in the program tries to solve it using its two logical algorithms, and if they fail at any stage it starts guessing. As stated in Wikipedia, "determining whether a Hashiwokakero puzzle has a solution is NP-complete" which means that, even with the help of the logical algorithms, the program could spend a very long time trying to solve some puzzles (especially if they have more than one solution or have been entered incorrectly). Therefore, the program has a time limit for solving external puzzles, and will give up after it has been reached, and will simply load one of its internal puzzles instead. This limit can be changed using the menu revealed by the jigsaw icon.
Checking for Errors
Clicking on the hand button causes the program to check the puzzle for errors. If errors are detected the hand will flip to the thumbs down position. A further click on the hand will undo all errors. Note that when a hint is requested the program always checks the puzzle for errors first. If errors are detected no hint search will be performed and the hand will flip to thumbs down. A click on the hand and the errors will be removed.
The Difficulty Score is the number to the right of the puzzle number. Though it can only provide a rough indication of how hard a player will find any particular puzzle, it does give a useful indication of the relative difficulty of puzzles. The difficulty for a player depends on the number of possible ways of satisfying each of the island bridge counts while linking all the island together. The difficulty score tries to reflect this and is calculated as follows.
Depending on its environment, any island will be able to "see" from 1-4 other islands along its intersecting grid lines. What matters is not the number of choices defined by the finished puzzle but the number that confronts the person attempting to solve the puzzle - ie the number of bridges and island needs and the islands that each island can "see" when the puzzle is started. For example an island with a bridge count of 1 which can only see one other island has one "choice", but if it could see 2 islands it could have a bridge in either direction and hence have 2 choices. An island with bridge count 8 also has one choice. We have looked at the possibilities and counted the number of choices for them all. According to our analysis the values range from 1 to 19. These give the difficulty for each island. The difficulty rating for a puzzle is simply the sum of the values for all its islands. Obviously, using this system, the bigger the puzzle the higher the rating.
The program contains only two hint algorithms. The first examines all the potential bridges from each island and, explicitly taking into account the two simple rules that an island with bridge count of 1 cannot link to another with bridge count of 1, and an island with bridge count of 2 can only have one bridge to another with bridge count of two, it finds essential bridges ie bridges that must exist in order to satisfy the island's bridge count. The second algorithm, which comes into play far less often, finds isolated sets of connected islands which need a single connection to join them to other sets of islands.
A guessing algorithm with backtracking is used when necessary to solve external puzzles.