C# Class BattleshipUtility.BattleshipGame

An instance of a battleship game
Afficher le fichier Open project: solium/hacklympics Class Usage Examples

Méthodes publiques

Méthode Description
GameLoop ( string opponent, int width, int height, List ships, BattleshipPlayer player ) : void

Main battleship game loop

Seed ( string opponent ) : void

Private Methods

Méthode Description
Accept ( string s ) : CommandResult

Handles the 'accept' command

Exit ( string s ) : CommandResult

Handles the 'exit' command

Fire ( string s ) : CommandResult

Handles the 'fire' command - sends out the next shot

GetEnemyPositions ( ) : void

When a win/loss/tie command is received, it is followed with a list of enemy positions - read these

Hit ( string s ) : CommandResult

Handles the 'hit' command - records last coordinates shot at as a hit

Incoming ( string s ) : CommandResult

Handles the 'incoming' command

Loss ( string s ) : CommandResult

Handles the 'loss' command

Miss ( string s ) : CommandResult

Handles the 'miss' command - records the last coordinates shot at as a miss

Reject ( string s ) : CommandResult

Handles the 'reject' command

Sink ( string s ) : CommandResult

Handles the 'sink' command - records a ship as sunk

Tie ( string s ) : CommandResult

Handles the 'tie' command

Win ( string s ) : CommandResult

Handles the 'win' command

Method Details

GameLoop() public méthode

Main battleship game loop
public GameLoop ( string opponent, int width, int height, List ships, BattleshipPlayer player ) : void
opponent string Name of opponent
width int Width of board
height int Height of board
ships List Ships in play
player BattleshipPlayer
Résultat void

Seed() public static méthode

public static Seed ( string opponent ) : void
opponent string
Résultat void