C#代写:COMP104 Battleship Card Game



This project will allow you to implement a computer game, with some simple graphics. It is a card game, where you will implement some simple artificial intelligence and incorporate it in the computer player.

Project Specification

Please use object-oriented programming in C# to produce a computer version of the Battleship Hidden Threat card game by Hasbro. It is a card game where players are competing to sink their opponent’s ships, by finding their position and playing the required number of ‘peg’ cards.
In Battleship Hidden Threat, two players lay out twelve coordinate cards randomly that represent their fleet positions. Five of the cards are their ships, and the rest are empty sea. Players then have a deck of ‘destruction’ cards, made up of white peg cards, red peg cards, and special cards. Players have a hand of five of these destruction cards. The players take turns placing one of these destruction cards on the coordinate cards to first find, and then hit and sink their opponent’s ships. After one card (or in the case of special cards, possibly more than one card) is played, the player draws back up to a hand of five. Revealed (found) ships require a specific number of hits to sink, and have special powers/abilities that work until they are sunk. When the required number of pegs has been played on a ship, it is sunk. The first player to sink all of their opponent’s ships wins! The full rules of the game are in the Battleship.pdf file.
There is also a simplified variant, which it would be good to implement first, and then offer the user to choose. In the simplified variant, there are no special cards, and the revealed ships do not have any special powers/abilities.
Your program should implement the game where the user plays against a computer player.

Robot player

A computerised version of this game will need a robot player to play against. At each turn, the robot player decides which card to play, and where to play it, in such a way that it can and find and then sink ships. The robot player must only make legal moves.
A purely random robot player would not be interesting to play against. So your robot player should have some artificial intelligence, or ‘heuristics’, such as using the ‘correct’ colour peg cards when finding, or hitting, a ship, and concentrating on sinking a ship once it is found. Getting the computer to play differently depending on what special cards or powers are in play would be ideal.

Card Distribution

In Battleship Hidden Threat, there are two identical decks of cards, one for each player, coloured red and blue. The twelve coordinate cards contain one card for each of the five ships (Submarine, PT Boat, Destroyer, Battleship and Aircraft Carrier) and seven open sea “miss” cards. The 26 destruction cards are either peg cards (10 × 1 white peg cards, 6 × 1 red peg cards, 3 × 2 red peg cards, 1 × 4 red peg cards) or special cards (two of each of the three types of special cards).


Write a C# program that satisfies the specifications described above. It should make use of the programming features that you have learnt so far, in particular using classes, subclasses, and methods to structure your program.
The project requires you to both get it verified in the lab and to submit the source code. Half of the grade will be based on how the program runs and half on the object-oriented design, code quality, and documentation.
We suggest that you build a simplified version of the game first, and then add in more features as time permits. Concentrate on getting the objects and simple turn play right before adding fancy graphics and controls. Some of the game rules are only needed for a card game and can be simplified to make an equally interesting computer game. It is often easier to control both players, adding a computer player once you have a basic game going. Once you have a stupid computer player, then you can add more intelligence and heuristics (preferably into subclasses).
If your program is structured well, you should be able to let the user choose which variant of the game they want to play, and the different behaviours are provided by setting which subtype of objects are used.