C# Pirate is a version of the classic Battleship game. The game is quite old and exists in various mutations. On this site we want to tell you the rules that apply to C# Pirates. Additionally you can read about the rules you have to follow when writing a computer player.
Rules of the Game
The game is played on two square grids ("playing fields"), one for each player. The grids are 10×10.
Before play begins, the gaming engine arranges the ships randomly on the grid for each player. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., at most one ship can occupy any given square in the grid). Ships must not adjoin each other (i.e. there has to be at least one water-square between them).
Here is a list of ships that are positioned on the grids:
|
Number
|
Type of ship
|
Size
|
| 1 |
Aircraft Carrier |
5 |
| 1 |
Battleship |
4 |
| 1 |
Cruiser |
3 |
| 1 |
Patrol Boat |
2 |
| 1 |
Submarine |
3 |
After the ships have been positioned, the game proceeds in a series of rounds. The player who starts the first game is determined by the gaming engine at random. In all following games the right to start rotates between the players.
In each round, each player has a turn. During a turn, the player announces a target squares in the opponents' grid which is to be shot at. If a ship occupies one of the squares, then it takes a hit. When all of the squares of a ship have been hit, the ship is sunk. If at the end of a round all of one player's ships have been sunk, the game ends and the other player wins.
Additional Rules for C# Pirates
Here are some special rules you computer player has to observe:
- If a computer player throws an exception the opponent is declared the winner.
- If a single call to the player's Move method takes longer than 0.5 seconds the player is terminated and the opponent is declared the winner.
- During a single call to the player's Move method a player must not call Fire more then once.
Please follow the guidelines mentioned in the Introduction and in the Documentation of the C# Pirates class library!