C# Class Go.Board

Show file Open project: paviad/GoSharp Class Usage Examples

Public Methods

Method Description
Board ( ) : System

Construct a board object from a parameter array. Each parameter may be 0 for empty, 1 for black or 2 for white, and the number of parameters must be a square of a natural number. The board size will be a square whose side length is the square root of the number of parameters.

Board ( Board fromBoard ) : System

Constructs a board object from an existing board object, copying its size and content.

Board ( int sx, int sy ) : System

Constructs a board object of specified horizontal and vertical size.

GetContentAt ( Point n ) : Content

Gets the board content at the specified point.

GetContentAt ( int x, int y ) : Content

Gets the board content at the specified point.

GetGroupAt ( Point n ) : Go.Group

Gets the group including the board content at the specified position.

GetGroupAt ( int x, int y ) : Go.Group

Gets the group including the board content at the specified position.

GetHashCode ( ) : int

Gets a hash code of this board. Hash code includes board content.

GetLiberties ( Go.Group group ) : int

Gets the liberty count of the specified group.

GetLiberties ( Point n ) : int

Gets the liberty count of the group containing the board content at the specified point.

GetLiberties ( int x, int y ) : int

Gets the liberty count of the group containing the board content at the specified point.

ResetScoring ( ) : void

Resets the scoring process, unmarking dead groups.

SetContentAt ( Point p, Content content ) : void

Sets the board content at the specified point, this is not considered a game move, but rather a setup move.

SetContentAt ( int x, int y, Content c ) : void

Sets the board content at the specified point, this is not considered a game move, but rather a setup move.

SetDeadGroup ( Point n ) : void

Marks a group as dead for the purposes of scoring. This method has no effect if the board is not in scoring mode (see the IsScoring property).

SetDeadGroup ( int x, int y ) : void

Marks a group as dead for the purposes of scoring. This method has no effect if the board is not in scoring mode (see the IsScoring property).

ToString ( ) : string

Returns a multi-line string representation of the board with the scoring state. Each spot is composed of two characters. The first is one of [.XO] representing an empty, black or white board content respectively. The second is one of [.xoD] representing unowned, black or white territory, or D for a dead group.

this ( Point n ) : Content

Gets or sets the board content at the specified point. Changing the board content using this property is not considered a game move, but rather a setup move.

this ( int x, int y ) : Content

Gets or sets the board content at the specified point. Changing the board content using this property is not considered a game move, but rather a setup move.

Private Methods

Method Description
CalcTerritory ( ) : void
Capture ( Go.Group g ) : int
Capture ( IEnumerable captures ) : int
ClearGroupCache ( ) : void
GetCapturedGroups ( int x, int y ) : List
GetContentHashCode ( ) : int
GetStoneNeighbours ( int x, int y ) : List
RecursiveAddPoint ( Go.Group group, int x, int y ) : void

Method Details

Board() public method

Construct a board object from a parameter array. Each parameter may be 0 for empty, 1 for black or 2 for white, and the number of parameters must be a square of a natural number. The board size will be a square whose side length is the square root of the number of parameters.
public Board ( ) : System
return System

Board() public method

Constructs a board object from an existing board object, copying its size and content.
public Board ( Board fromBoard ) : System
fromBoard Board The source board object.
return System

Board() public method

Constructs a board object of specified horizontal and vertical size.
public Board ( int sx, int sy ) : System
sx int The horizontal size of the board.
sy int The vertical size of the board.
return System

GetContentAt() public method

Gets the board content at the specified point.
public GetContentAt ( Point n ) : Content
n Point The coordinates of the position.
return Content

GetContentAt() public method

Gets the board content at the specified point.
public GetContentAt ( int x, int y ) : Content
x int The X coordinate of the position.
y int The Y coordinate of the position.
return Content

GetGroupAt() public method

Gets the group including the board content at the specified position.
public GetGroupAt ( Point n ) : Go.Group
n Point The coordinates of the position.
return Go.Group

GetGroupAt() public method

Gets the group including the board content at the specified position.
public GetGroupAt ( int x, int y ) : Go.Group
x int The X coordinate of the position.
y int The Y coordinate of the position.
return Go.Group

GetHashCode() public method

Gets a hash code of this board. Hash code includes board content.
public GetHashCode ( ) : int
return int

GetLiberties() public method

Gets the liberty count of the specified group.
public GetLiberties ( Go.Group group ) : int
group Go.Group The group object.
return int

GetLiberties() public method

Gets the liberty count of the group containing the board content at the specified point.
public GetLiberties ( Point n ) : int
n Point The coordinates of the position.
return int

GetLiberties() public method

Gets the liberty count of the group containing the board content at the specified point.
public GetLiberties ( int x, int y ) : int
x int The X coordinate of the position.
y int The Y coordinate of the position.
return int

ResetScoring() public method

Resets the scoring process, unmarking dead groups.
public ResetScoring ( ) : void
return void

SetContentAt() public method

Sets the board content at the specified point, this is not considered a game move, but rather a setup move.
public SetContentAt ( Point p, Content content ) : void
p Point The coordinates of the position.
content Content The new content at the position.
return void

SetContentAt() public method

Sets the board content at the specified point, this is not considered a game move, but rather a setup move.
public SetContentAt ( int x, int y, Content c ) : void
x int The X coordinate of the position.
y int The Y coordinate of the position.
c Content The new content at the position.
return void

SetDeadGroup() public method

Marks a group as dead for the purposes of scoring. This method has no effect if the board is not in scoring mode (see the IsScoring property).
public SetDeadGroup ( Point n ) : void
n Point The coordinates of the position of a stone in the group.
return void

SetDeadGroup() public method

Marks a group as dead for the purposes of scoring. This method has no effect if the board is not in scoring mode (see the IsScoring property).
public SetDeadGroup ( int x, int y ) : void
x int The X coordinate of a position belonging to the group.
y int The Y coordinate of a position belonging to the group.
return void

ToString() public method

Returns a multi-line string representation of the board with the scoring state. Each spot is composed of two characters. The first is one of [.XO] representing an empty, black or white board content respectively. The second is one of [.xoD] representing unowned, black or white territory, or D for a dead group.
public ToString ( ) : string
return string

this() public method

Gets or sets the board content at the specified point. Changing the board content using this property is not considered a game move, but rather a setup move.
public this ( Point n ) : Content
n Point The coordinates of the position.
return Content

this() public method

Gets or sets the board content at the specified point. Changing the board content using this property is not considered a game move, but rather a setup move.
public this ( int x, int y ) : Content
x int The X coordinate of the position.
y int The Y coordinate of the position.
return Content