C# Класс BattleshipUtility.BattleshipGame

An instance of a battleship game
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GameLoop ( string opponent, int width, int height, List ships, BattleshipPlayer player ) : void

Main battleship game loop

Seed ( string opponent ) : void

Приватные методы

Метод Описание
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

Описание методов

GameLoop() публичный Метод

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
Результат void

Seed() публичный статический Метод

public static Seed ( string opponent ) : void
opponent string
Результат void