C# 클래스 BattleshipUtility.BattleshipGame

An instance of a battleship game
파일 보기 프로젝트 열기: solium/hacklympics 1 사용 예제들

공개 메소드들

메소드 설명
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