Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeIterator ¶
MakeIterator makes a generic iterator of a board of colours
func ReturnIterator ¶
Types ¶
type Coord ¶
type Coord struct {
X, Y int16
}
Coord represents a (row, col) coordinate. Given we're unlikely to actually have a board size of 255x255 or greater, a pair of bytes is sufficient to represent the coordinates
The Coord uses a standard computer cartesian coordinates
- (0, 0) represents the top left
- (18, 18) represents the bottom right of a 19x19 board
- (255, 255) represents a "pass" move
- (254, 254) represents a "resign" move
func (Coord) IsResignation ¶
IsResignation returns true when the coordinate represents a "resignation" move
type Coordinate ¶
Coordinate is a representation of coordinates. This is typically a move
type GifEncoder ¶
func NewGifEncoder ¶
func NewGifEncoder(h, w int) *GifEncoder
func (*GifEncoder) Encode ¶
func (enc *GifEncoder) Encode(ms MetaState) error
func (*GifEncoder) Flush ¶
func (enc *GifEncoder) Flush() error
type KomiSetter ¶
KomiSetter is any State that can set a Komi score.
The komi score may be acquired from the State via AdditionalScore()
type PlayerMove ¶
PlayerMove is a tuple indicating the player and the move to be made.
For now, the move is a Single. The original implementation took a Coordinate
func (PlayerMove) Eq ¶
func (p PlayerMove) Eq(other PlayerMove) bool
Eq returns true if both are equal
type Single ¶
type Single int32
Single represents a coordinate as a single 8-bit number, utilized in a rowmajor fashion.
- 0 represents the top left
- 18 represents the top right
- 19 represents (1, 0)
- -1 represents the "pass" move
- -2 represents the "resignation" move
func (Single) IsResignation ¶
IsResignation returns true when the coordinate represents a "resignation" move
type State ¶
type State interface { // These methods represent the game state BoardSize() (int, int) // returns the board size Board() []Colour // returns the board state ActionSpace() int // returns the number of permissible actions Hash() Zobrist // returns the hash of the board ToMove() Player // returns the next player to move (terminology is a bit confusing - this means the current player) Passes() int // returns number of passes that have been made MoveNumber() int // returns count of moves so far that led to this point. LastMove() PlayerMove // returns the last move that was made Handicap() int // returns a handicap (i.e. allow N moves) // Meta-game stuff Score(p Player) float32 // score of the given player AdditionalScore() float32 // additional tie breaking scores (like komi etc) Ended() (ended bool, winner Player) // has the game ended? if yes, then who's the winner? // interactions SetToMove(Player) // set the next player to move Check(m PlayerMove) bool // check if the placement is legal Apply(m PlayerMove) State // should return a GameState. The required side effect is the NextToMove has to change. Reset() // reset state // For MCTS Historical(i int) []Colour // returns the board state from history UndoLastMove() Fwd() // generics Eq(other State) bool Clone() State }
State is any game that implements these and are able to report back