Battleship applet

Click here to play when you have read the instructions. IF THE BATTLESHIP SERVER IS NOT RUNNING AND YOU WANT TO TRY IT OUT, CONTACT ME.

This is an applet version of the battleship program that can be run in either one or two-player mode. The applet creates a frame window which can be moved as you wish, but not resized. There are two menus. The first ("Game") gives options for:

  1. playing against the computer, or
  2. playing against another player on another machine (or you can play against yourself on the machine by loading a second version of the program).
  3. quitting the program
The second ("Help") just gives version information.

Playing against the computer

You must place your ships first by clicking in the blue grid and choosing horizontal or vertical from the dialog box. The ships are placed in the order: aircraft carrier, battleship, destroyer, cruiser, submarine. When all the ships are placed, you can start the game by making a guess in the red grid. You guess will be recorded, and the computer's guess will be announced in a message box. Play proceeds until one player wins. You may quit at any time. The computer's "strategy" is to make purely random guesses, so it is not hard to beat.

Playing against another program

You will asked for a name by which the server identifies you. Any sequence of up to 20 characters may be typed. You will then need to place your ships (see playing against the computer, above) before contacting the server. The server will send you a list of other players who are ready to play (and "none"). If there are no other players known to the server, then you will not get any response--the program will just wait. If you do get a list of names, you must choose a player or "none" to proceed. When you choose another player, your offer is sent to him or her and they get a chance to accept the offer or refuse it. You may also get an offer to play, in which case you get to choose. When an offer is accepted, one player is chosen by the computer to start. You will either get a "You go first" box, or you must wait for the other player's first guess. Guesses then alternate until a player wins, or somebody quits, which you can do when it is your turn to make a guess.

Limitations

This program (and the server) has not been full tested and debugged. Things I know don't work are: the offer to proceed after the opponent quits; choosing a name that already exists in the server's list; choosing quit when it is not your turn; quitting by exiting the browser; suspending the applet by minimizing the browser window. One thing I have not tested: two people making an offer to play the same player.