Page 1 of 1

Solitaire Battleships

Posted: Tue May 15, 2012 6:52 pm
by wayne
Intro from the comments at the beginning of the source file:

Solitaire Battleships
Original code by Wayne Moore © 2012 (You may use any of this code, but unless you change it substantially, I would like some credit.)

Concept and design of puzzles is property of Conceptis LTD. Visit http://www.conceptispuzzles.com for more information.
These puzzles are featured regularly in GAMES magazine. Visit them at gamesmagazine-online.com

This is the solitaire version of the classic Battleships game.
The grid represents a section of ocean in which a fleet of ships is hiding.
The fleet usually consists of a battleship, four grid cells in length, Two cruisers, each three cells in length, Three destroyers, each two cells in length, And four submarines, of one cell each
The ships may be oriented horizontally or vertically, (never diagonally) and no two ships can occupy adjacent grid cells; Not even diagonally.
The digits along the sides and bottom indicate the number of cells in their corresponding rows and columns that are occupied by vessels.

Some "shots" have been taken to start you off. These may show water, (a blue cell,) a submarine, (a circle,) the bow or stern of a ship, (a rounded off square,) or a midsection of a battleship or a cruiser (a square.)

I have tested it, and it seems to work pretty well.
There is currently no undo feature, though I intend to work on one as time permits.
There is no in-game help available yet, though I intend to put it in there eventually.
Comments are sparse, though I intend to add to them, eventually.

17MAY2012 fixed the ini file path issue so it should load most recent file properly on initial startup.
Changed interface a bit, and added persistent preferences
1.3.7-18MAY2012 Added undo feature, moved and changed some things, added comments
1.5.1 21MAY2012 added routines to look at surrounded pieces and change them automatically
1.5.4 22MAY2012 fixed a bug that threw errors when trying to save progress on closing the program.
Also removed some redundant code and added a few comments.
1.5.5 27MAY2012 fixed an undo problem, made file name of puzzle display in title bar, made auto-finding a ship segment optional
1.5.7 28MAY2012 fixed drag-right-click issue; now it will draw water or blank without switching back and forth. Also changed solve-checking; turned it into a function. Rearranged some routines for better efficiency.