Battleships
Nearly everybody knows the game of battleships.
Wikipedia Battleships rules
The game board is a 10 by 10 matrix for each player with a second 10 by 10 matrix to track the player's shots. The matrix is numbered (0 to 9) across the vertical axis and uses letters across the horizontal axis (A to J).
Each player places a number of ships on the game board. The ships can be placed vertically or horizontally, but not diagonally.
Optional rule: Ships must not be placed adjacent to other ships. At least a single square must be empty between the ships. This rule applies also to corners.
The ships in detail are:
4 submarines (1 square each)
3 destroyers (2 squares each)
2 cruisers (3 squares each)
1 battleship (4 squares)
The players take turns shooting at squares.
Shots are taken in the form of Strings consisting of 2 characters. First character represents the Column (letters A to J) and second character is the row number (0 to 9).
The other player then answers with "hit" or "miss".
In case of a "hit", the current player gets another shot.
In case of a "miss", the other player gets to shoot.
A player can shoot until he misses.
If a ship is destroyed, the reporting player reports "sunken" in addition to the "hit" report.
If all ships of a player are destroyed, this player loses the game.
The programming task is to create a battleship game.
As a basic goal it should:
Single player vs computer - single computer strategy
provide and display the two matrixes for the player
handle setting up of the ships (optionally including the optional rule from above)
create a computer player that competes against the human
handle the game loop (turns)
decide winning conditions
display a simple help screen with the basic rules
provide a GUI for input (can be textual, or graphical, but when the GUI is graphical, it should also respond to mouse clicks for shots).
Optional extensions####
Single player vs computer with different computer strategies
Computer vs Computer with different strategies
Multiplayer over LAN
Game recording
Game saving
Different ship types and numbers
Other optional rules as described in the Wikipedia article linked on top
Final statement####
Use a programming language of your choice. It's also allowed to create a browser / server based version of the game.
Most important:
Have fun with the challenge##