C# 클래스 BattleshipUtility.Ship

Describes a ship
상속: ICloneable
파일 보기 프로젝트 열기: solium/hacklympics 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
Position Position

공개 메소드들

메소드 설명
Adjacent ( Position p ) : bool

Determines if a point is adjacent to a ship

Adjacent ( Ship ship ) : bool

Returns true if a ship is adjacent to this ship

AdjacentPositions ( int width, int height ) : IEnumerable

List of positions adjacent to a ship

At ( Position p ) : bool

Determines if a ship occupies a position

AtOrAdjacent ( Position p ) : bool

Creates a 1-space border around a ship and checks if a position is within this border

Clone ( ) : object
Intersects ( Ship ship ) : bool

Whether or not a ship intersects another ship

IntersectsOrAdjacent ( Ship ship ) : bool

Whether or not a ship intersects or is next to another ship

Parse ( string s ) : Ship
Place ( int width, int height ) : void

Randomly places a ship on a grid

ToString ( ) : string

Describes a ship

메소드 상세

Adjacent() 공개 메소드

Determines if a point is adjacent to a ship
public Adjacent ( Position p ) : bool
p Position position
리턴 bool

Adjacent() 공개 메소드

Returns true if a ship is adjacent to this ship
public Adjacent ( Ship ship ) : bool
ship Ship
리턴 bool

AdjacentPositions() 공개 메소드

List of positions adjacent to a ship
public AdjacentPositions ( int width, int height ) : IEnumerable
width int
height int
리턴 IEnumerable

At() 공개 메소드

Determines if a ship occupies a position
public At ( Position p ) : bool
p Position Position to check
리턴 bool

AtOrAdjacent() 공개 메소드

Creates a 1-space border around a ship and checks if a position is within this border
public AtOrAdjacent ( Position p ) : bool
p Position Position to check
리턴 bool

Clone() 공개 메소드

public Clone ( ) : object
리턴 object

Intersects() 공개 메소드

Whether or not a ship intersects another ship
public Intersects ( Ship ship ) : bool
ship Ship
리턴 bool

IntersectsOrAdjacent() 공개 메소드

Whether or not a ship intersects or is next to another ship
public IntersectsOrAdjacent ( Ship ship ) : bool
ship Ship
리턴 bool

Parse() 공개 정적인 메소드

public static Parse ( string s ) : Ship
s string
리턴 Ship

Place() 공개 메소드

Randomly places a ship on a grid
public Place ( int width, int height ) : void
width int width of grid
height int height of grid
리턴 void

ToString() 공개 메소드

Describes a ship
public ToString ( ) : string
리턴 string

프로퍼티 상세

Position 공개적으로 프로퍼티

Top-Left Position of the ship on the game board
public Position Position
리턴 Position