battleship
"You sank my battleship!"  Alas, the cry that sounds no longer.  Until now....   Of course, you'd be talking to the computer if you said that....  *shrug*   If you've played this before, go on ahead.  Otherwise, you might want to read the explanation at the bottom, to let you know what's what on the screen.  I admit, it's not very friendly looking, but if I'd wanted to do computer graphics, I'd have done computer graphics.  Your opponent is the computer.  Enjoy.

Explanation of Battleship: You've got 5 ships, your opponent has 5 ships.  You try to sink his, he tries to sink yours.  This is accomplished by using bombs or mines or something.  For some reason, the ships all seem to be in stealth mode.  You will not be able to determine their position until you see the explosion of your projectiles hitting the ship.  Therefore, you take guesses as to where they are.  You miss or you hit: sinking a ship can only be accomplished if you hit the whole thing.  You're trying to sink all of his ships before he sinks yours.  Have fun.

It starts out prompting you to place your 5 ships on the grid.  You do this by clicking once where you want one end of the ship to be, and then clicking on where you want the other end of the ship to be.  Ships can only be placed in horizontal or vertical lines.  If you select something that is not along those lines, or if you select two ends that are not of the proper distance apart, you will be prompted to try again.  The x indicates where you wanted the first end to be.  The ships you have at your disposal are: 1 ship of 2 spaces, 1 ship of 3 spaces, 2 ships of 4 spaces, and 1 ship of 5 spaces.  The computer has the same.  Your ships are big blue rectangles.  Deal with it.

Once you finish placing your ships, the top grid will be the grid that shows where your ships are, and where the computer has made his moves.  The grid that appears at the bottom is where you will indicate your moves, and where your moves will be recorded.

Gray squares indicate misses.  Red squares indicate hits.  When one of your ships sinks, it will become purple.  You will not know where his ships are after you have sunk them.  The only indication will be at the bottom of the screen, where it tracks how many of the enemy you have destroyed.

The game ends when all of someone's 5 ships are sunk.  When the game is over, the location of the computer ships will be outlined in cyan for your personal edification.

I think that's it.  Have at it.

Oh, and if it locks up in an infinite loop.... umm, well, it shouldn't, but if it does, let me know.  I'd like to take care of that.  I started getting this infinite loop where I couldn't figure it out, so I stuck in some debugging statements, and since then I haven't seen a recurrence of it....   Silly program.

The AI is by no means perfect.  I know there's a fairly sizable hole that you might note and laugh at, but please don't mock it too much.  It's liable to pout and start infinitely looping on you.  I haven't figured out how to get around it yet, that's all.

And yes, lots of the text isn't centered, and neither are the ships or the squares.  This is already noted.

Battleship is probably trademarked by someone, probably Mattel.  Standard disclaimers apply.

Technically, v.1.0 would have been the version that has been posted since 11.02.99.  Version 2.0 sports a slightly different, and hopefully better, AI, although that hole is still there.

last updated: 01.19.01
back to main