|
|
This applet was inspired by Gordon & Shenk's wonderful puzzle book, Solitaire Battleships.
This Game is Hard.
Appropriately generalized, Solitaire Battleships (aka. Yubotu) is NP-complete.
The Rules
The objective is to deduce the locations of all ships in the grid from clues given to you.
The Clues:
- The numbers along the bottom and right edges of the grid indicate how many cells in that column/row hide a piece of a ship.
- If a row/column number is BLUE, then it is completely satisfied.
If it is RED, then you have placed either more ship segments or more water segments in that row/column than there actually exist!
If it is GREEN, then you should feel good. The remaining empty cells may be filled in with either all ships or all water (it's easy to determine which) to completely satisfy this row/column.
If it is GRAY, then more undetected ship segments lie in that row/column. There is not enough information to mark this row/column as green.
- The ships on the right of the grid indicate the number and size of each ship in the game.
- When you find a whole ship, a corresponding ship on the right will turn blue to indicate that it has been sunk.
The Ships:
(Not all puzzles include every type of ship)
| Submarine |  |
| Destroyer |  |
| Cruiser |  |
| Battleship |  |
| Carrier |  |
Ship Rules:
- Ships on the grid may lie horizontally or vertically.
- Ships may not occupy adjacent squares! (so adjacent squares must be water...)
- The game will paint red any arrangement of ships that does not follow these rules
Starting the Game
Choose a puzzle from the drop-down list at the top of the applet. Click on the New Game button to load and play that puzzle.
Some puzzles fill in the locations of some of the ships for you at the start. These quadrants are slightly darker. You cannot change these squares during the game (Why would you? They're already correct!)
Using the Mouse:
- To mark a square with a ship, click the left mouse button.
- To mark a square with water, click the right mouse button.
- To unmark a ship square, click the left mouse button.
- To unmark a water square, click the right mouse button.
- If you do not have a two-button mouse, or prefer to use one button, place a check in the One Button Mouse checkbox. Clicking on a hidden square will mark it with water. Clicking again will mark it with a ship segment. Clicking once more will mark it as hidden again.
The Standard Game
A normal game will consist of 4 submarines, 3 destroyers, 2 cruisers, and 1 battleship hidden on a 10 by 10 grid.
Strategy
Obviously, you'll need a couple of strategies to solve the puzzles - even the easy ones. Here are some tips:
- Look for blue row/column numbers and fill in the empty squares in that row/column with water
- Deduce the location of other ships/water from the starting ships.
If it's a submarine, then fill in the 8 surrounding cells with water.
If it's the end of a ship, then you know that the ship extends into that adjacent square. You also know that all adjacent squares are water.
If it's the middle of a ship, then it could be horizontal or vertical. Fill in the 4 adjacent corner squares with water, then look at the row/column numbers for that middle square. If one of them is less than 3, then the ship cannot lie in that row/column and must extend perpendicular to it.
- Look at the row/column numbers again. If the number exactly corresponds to the number of empty squares plus the number of ship segments displayed in that row/column, then you know that all of those empty squares are ship squares. Fill them in, then fill in any adjacent water squares.
- Look at the row/column numbers once more. If you still haven't found the battleship and there's only one row/column number greater than 3, then it's got to be in that row. You get the the idea :)
That, of course, isn't a complete strategy - you'll need to work out your own - but it'll get you started.
The Undo / Redo Buttons
You can backtrack and retrace your moves using the undo and redo buttons. This is especially useful for testing hypotheses such as What if the battleship were in the top row? Where would the cruisers then have to be? And the destroyers? Ah.... If you suspect placing a ship somewhat might lead to a contradiction, this is a good way to test.
The Ship Squares
Note that the computer will help you determine how much you know about a specific ship segment.
 | A submarine |
 | The right part of the ship is obviously the bow (or stern).
However, the left part is pointed to indicate that you do not have enough information to determine whether the ship continues in that direction. |
 | This is the middle of a ship (vertical or horizontal). |
 | This is either a submarine or the bow/stern of a ship, but you can't yet make the distinction. |
 | This could be any part of a ship (horizontal or vertical) or a submarine |
 | This could be any part of a ship or a submarine, but you know that if it is a ship, it must extend horizontally. |
 | This could be any part of a ship or a submarine, but you know that if it is a ship, it must extend vertically. |
Send me your puzzles!
Making puzzles is easy! If you'd like to add some of your own creations, send them to me please! Take a look at the text files in the puzzles directory to get an idea of the format for creating your own puzzle files.
File format
- The first line contains the name,
- The remaining lines are a grid representation of the board populated with ships and water.
Ships are represented by a 'o' (lowercase "oh"). Water is represented by a '.' (a period).
You can also specify some ships and water cells to be revealed at the beginning of the game.
Revealed ships are represented by an '@' (an "at" sign). Revealed water is represented by a '~' (a tilde).
Here's an example of a puzzle file called my.first.puzzle.easy:
(note: some browsers fail to display this with a fixed-width font - sorry, but I can't help that)
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9
Line 10
Line 11
Line 12
Line 13
Line 14
|
My First Puzzle (it's easy!)
# Column
# 0 1 2 3 4 5 6 7 8 9
o . . . . . . . . . # Row 0
o . o o o . . ~ . . # Row 1
o . . . . . . . . . # Row 2
o . . . @ . . . . . # Row 3
~ . o . o . . . . . # Row 4
o . . . . . o o o . # Row 5
o . . . o . . . . . # Row 6
. . . . o . . @ . . # Row 7
. . . . . . . . . . # Row 8
o . . . o . . . . . # Row 9
|
<-- The name
-+
|
|
| +----------+
+-+The puzzle|
| |grid |
| +----------+
|
|
-+
|
Notice that empty lines and whitespace are ignored and comments are allowed after a '#'.
Here is a template file if you'd like one.
A Tip:
When making puzzles, I suggest that you try and solve them first! It's very easy to make very hard puzzles.
A better puzzle is perhaps one that slowly reveals information about the board, bit by bit, and requires no
guessing (ie. there is a unique solution).
Have fun!
|
|
Want to drop me a note? Do so:
|
|
|