C# 클래스 GR.Gambling.Backgammon.Board

파일 보기 프로젝트 열기: alexhanh/Botting-Library 1 사용 예제들

공개 메소드들

메소드 설명
AddToPoint ( int player, int point, int count ) : void
Board ( ) : System
Board ( Board board ) : System

Deep-copy constructor.

BoardRelativeTo ( int player ) : int[]

Returns the board relative to the player, so that the slots 0-5 match the player's home board. Negative counts indicate opponents checkers.

CapturedCount ( int player ) : int
Clone ( ) : Board

Creates a deep-copy of this board.

DecreaseCaptured ( int player ) : void
DecreaseFinished ( int player ) : void
Deserialize ( string s ) : Board
Empty ( ) : void
EmptyPoint ( int player, int point ) : void
Equals ( Board board ) : bool
FinishedCount ( int player ) : int
ForcedMoves ( List legal_move_sequences ) : List

A move is a forced move if it must be made before other moves and every move hint share the same forced move.

HashString ( ) : string

Provides a unique hash string for each different board position.

IncreaseCaptured ( int player ) : void
IncreaseCaptured ( int player, int count ) : void
IncreaseFinished ( int player ) : void
IncreaseFinished ( int player, int count ) : void
InitializeBoard ( BackgammonVariation variation ) : void
IsBearoff ( int player ) : bool

Returns true if player's all chequers are on his home board and is bearing off.

IsLegal ( ) : bool
IsLegalMove ( int player, Move move, int die ) : bool

Returns if the given move for the given player is a valid move.

IsPureRace ( ) : bool

Returns true if both player's checkers have "passed" each others so that it's impossible to hit or block anymore. Source: http://www.bkgm.com/gloss/lookup.cgi?pure+race

IsStartingPosition ( BackgammonVariation variation ) : bool
LastChequer ( int player ) : int

Returns the point of the last chequer of the player from the player's perspective. Returns 24 for captured and -1 if all checkers have been bearoffed.

LegalPlays ( int player, int dice ) : List

This returns all the possible legal moves for the player with given dice. It sorts the dice from highest to lowest, so it produces same results regardless of the dice order. It also finds correctly moves according to following rules: "For any roll, if a player can move both dice, that player is compelled to do so. If it is possible to move either die, but not both, the higher number must be played. Further, if one die is unable to be moved, but such a move is made possible by the moving of the other die, that move is compulsory." Source: http://en.wikipedia.org/wiki/Backgammon

MakeMove ( int player, Move move ) : void

Applys a given move to this board. This method assumes the move is valid.

MakeMoves ( int player, IEnumerable moves ) : void
MakePlay ( int player, Play play ) : void
PipCount ( int player ) : int
PointCount ( int player, int point ) : int

Returns the count of this player's perspective. Count is negative if opponent has checkers on the given slot.

RemoveFromPoint ( int player, int point, int count ) : void
ResignationValue ( int player ) : ResignValue

Returns the current resign value for the player based on the last chequer's position.

Serialize ( Board board ) : string
SetCaptured ( int player, int count ) : void
SetFinished ( int player, int count ) : void
SetPoint ( int player, int point, int count ) : void

Sets the given slot to count from player's perspective.

ToString ( ) : string
ToString ( int player ) : string

Gnubg style rendering of the board from the perspective of player. X is always the player's checkers, O opponent's.

UndoMove ( int player, Move move ) : void

Reverses a given move that was made. Notice that if you are reversing a made move sequence, you need to do it in reverse order, that is, undo the last made move first, then the second last, and so on.

UndoPlay ( int player, Play play ) : void

비공개 메소드들

메소드 설명
Recursion ( int player, List free_dice, Board board, List moves_made, List &plays, List &partial_plays, HashSet &board_hash ) : void

메소드 상세

AddToPoint() 공개 메소드

public AddToPoint ( int player, int point, int count ) : void
player int
point int
count int
리턴 void

Board() 공개 메소드

public Board ( ) : System
리턴 System

Board() 공개 메소드

Deep-copy constructor.
public Board ( Board board ) : System
board Board
리턴 System

BoardRelativeTo() 공개 메소드

Returns the board relative to the player, so that the slots 0-5 match the player's home board. Negative counts indicate opponents checkers.
public BoardRelativeTo ( int player ) : int[]
player int
리턴 int[]

CapturedCount() 공개 메소드

public CapturedCount ( int player ) : int
player int
리턴 int

Clone() 공개 메소드

Creates a deep-copy of this board.
public Clone ( ) : Board
리턴 Board

DecreaseCaptured() 공개 메소드

public DecreaseCaptured ( int player ) : void
player int
리턴 void

DecreaseFinished() 공개 메소드

public DecreaseFinished ( int player ) : void
player int
리턴 void

Deserialize() 공개 정적인 메소드

public static Deserialize ( string s ) : Board
s string
리턴 Board

Empty() 공개 메소드

public Empty ( ) : void
리턴 void

EmptyPoint() 공개 메소드

public EmptyPoint ( int player, int point ) : void
player int
point int
리턴 void

Equals() 공개 메소드

public Equals ( Board board ) : bool
board Board
리턴 bool

FinishedCount() 공개 메소드

public FinishedCount ( int player ) : int
player int
리턴 int

ForcedMoves() 공개 정적인 메소드

A move is a forced move if it must be made before other moves and every move hint share the same forced move.
public static ForcedMoves ( List legal_move_sequences ) : List
legal_move_sequences List
리턴 List

HashString() 공개 메소드

Provides a unique hash string for each different board position.
public HashString ( ) : string
리턴 string

IncreaseCaptured() 공개 메소드

public IncreaseCaptured ( int player ) : void
player int
리턴 void

IncreaseCaptured() 공개 메소드

public IncreaseCaptured ( int player, int count ) : void
player int
count int
리턴 void

IncreaseFinished() 공개 메소드

public IncreaseFinished ( int player ) : void
player int
리턴 void

IncreaseFinished() 공개 메소드

public IncreaseFinished ( int player, int count ) : void
player int
count int
리턴 void

InitializeBoard() 공개 메소드

public InitializeBoard ( BackgammonVariation variation ) : void
variation BackgammonVariation
리턴 void

IsBearoff() 공개 메소드

Returns true if player's all chequers are on his home board and is bearing off.
public IsBearoff ( int player ) : bool
player int
리턴 bool

IsLegal() 공개 메소드

public IsLegal ( ) : bool
리턴 bool

IsLegalMove() 공개 메소드

Returns if the given move for the given player is a valid move.
public IsLegalMove ( int player, Move move, int die ) : bool
player int The player for whom the move is made.
move Move The move to be made, slot indices must be relative to the player making the move.
die int The die with which the move is made.
리턴 bool

IsPureRace() 공개 메소드

Returns true if both player's checkers have "passed" each others so that it's impossible to hit or block anymore. Source: http://www.bkgm.com/gloss/lookup.cgi?pure+race
public IsPureRace ( ) : bool
리턴 bool

IsStartingPosition() 공개 메소드

public IsStartingPosition ( BackgammonVariation variation ) : bool
variation BackgammonVariation
리턴 bool

LastChequer() 공개 메소드

Returns the point of the last chequer of the player from the player's perspective. Returns 24 for captured and -1 if all checkers have been bearoffed.
public LastChequer ( int player ) : int
player int
리턴 int

LegalPlays() 공개 메소드

This returns all the possible legal moves for the player with given dice. It sorts the dice from highest to lowest, so it produces same results regardless of the dice order. It also finds correctly moves according to following rules: "For any roll, if a player can move both dice, that player is compelled to do so. If it is possible to move either die, but not both, the higher number must be played. Further, if one die is unable to be moved, but such a move is made possible by the moving of the other die, that move is compulsory." Source: http://en.wikipedia.org/wiki/Backgammon
public LegalPlays ( int player, int dice ) : List
player int
dice int
리턴 List

MakeMove() 공개 메소드

Applys a given move to this board. This method assumes the move is valid.
public MakeMove ( int player, Move move ) : void
player int
move Move
리턴 void

MakeMoves() 공개 메소드

public MakeMoves ( int player, IEnumerable moves ) : void
player int
moves IEnumerable
리턴 void

MakePlay() 공개 메소드

public MakePlay ( int player, Play play ) : void
player int
play Play
리턴 void

PipCount() 공개 메소드

public PipCount ( int player ) : int
player int
리턴 int

PointCount() 공개 메소드

Returns the count of this player's perspective. Count is negative if opponent has checkers on the given slot.
public PointCount ( int player, int point ) : int
player int Relative player from whos perspective the query is made.
point int
리턴 int

RemoveFromPoint() 공개 메소드

public RemoveFromPoint ( int player, int point, int count ) : void
player int
point int
count int
리턴 void

ResignationValue() 공개 메소드

Returns the current resign value for the player based on the last chequer's position.
public ResignationValue ( int player ) : ResignValue
player int
리턴 ResignValue

Serialize() 공개 정적인 메소드

public static Serialize ( Board board ) : string
board Board
리턴 string

SetCaptured() 공개 메소드

public SetCaptured ( int player, int count ) : void
player int
count int
리턴 void

SetFinished() 공개 메소드

public SetFinished ( int player, int count ) : void
player int
count int
리턴 void

SetPoint() 공개 메소드

Sets the given slot to count from player's perspective.
public SetPoint ( int player, int point, int count ) : void
player int The player from whose perspective the slot is mapped.
point int
count int Positive count is for the player, negative for the opponent. Zero count empties the slot for both players.
리턴 void

ToString() 공개 메소드

public ToString ( ) : string
리턴 string

ToString() 공개 메소드

Gnubg style rendering of the board from the perspective of player. X is always the player's checkers, O opponent's.
public ToString ( int player ) : string
player int
리턴 string

UndoMove() 공개 메소드

Reverses a given move that was made. Notice that if you are reversing a made move sequence, you need to do it in reverse order, that is, undo the last made move first, then the second last, and so on.
public UndoMove ( int player, Move move ) : void
player int
move Move
리턴 void

UndoPlay() 공개 메소드

public UndoPlay ( int player, Play play ) : void
player int
play Play The play in which moves are in the order they were applied to the board and not reversed.
리턴 void