Documentation
¶
Overview ¶
package 围碁 implements Go (the board game) related code
围碁 is a bastardized word. The first character is read "wei" in Chinese. The second is read "qi" in Chinese. However, the charcter 碁 is no longer actively used in Chinese. It is however, actively used in Japanese. Specifically, it's read "go" in Japanese.
The main reason why this package is named with unicode characters instead of `package go` is because the standard library of the Go language have the prefix "go"
Index ¶
- Constants
- func IsValid(p game.Player) bool
- func Opponent(p game.Player) game.Player
- func StartGTP(genmove func(colour int, board *GTPBoard) string, name string, version string)
- type AgogoBoard
- type Board
- type GTPBoard
- func (b *GTPBoard) AllLegalMoves(colour int) []Point
- func (b *GTPBoard) Clear()
- func (b *GTPBoard) Copy() *GTPBoard
- func (b *GTPBoard) Dump()
- func (b *GTPBoard) GroupHasLiberties(x, y int) bool
- func (b *GTPBoard) NewFromMove(colour, x, y int) (*GTPBoard, error)
- func (b *GTPBoard) NewFromPass(colour int) (*GTPBoard, error)
- func (b *GTPBoard) Pass(colour int) error
- func (b *GTPBoard) PlayMove(colour, x, y int) error
- func (b *GTPBoard) String() string
- func (b *GTPBoard) StringFromPoint(p Point) string
- func (b *GTPBoard) StringFromXY(x, y int) string
- func (b *GTPBoard) XYFromString(s string) (int, int, error)
- type Game
- func (g *Game) ActionSpace() int
- func (g *Game) AdditionalScore() float32
- func (g *Game) Apply(m game.PlayerMove) game.State
- func (g *Game) Board() []game.Colour
- func (g *Game) BoardSize() (int, int)
- func (g *Game) Check(m game.PlayerMove) bool
- func (g *Game) Clone() game.State
- func (g *Game) Ended() (ended bool, winner game.Player)
- func (g *Game) Eq(other game.State) bool
- func (g *Game) Fwd()
- func (g *Game) Handicap() int
- func (g *Game) Hash() game.Zobrist
- func (g *Game) Historical(i int) []game.Colour
- func (g *Game) IsEye(m game.PlayerMove) bool
- func (g *Game) LastMove() game.PlayerMove
- func (g *Game) MoveNumber() int
- func (g *Game) Passes() int
- func (g *Game) Reset()
- func (g *Game) Score(p game.Player) float32
- func (g *Game) SetToMove(p game.Player)
- func (g *Game) SuperKo() bool
- func (g *Game) ToMove() game.Player
- func (g *Game) UndoLastMove()
- type Point
Constants ¶
const ( BORDER = -1 EMPTY = 0 BLACK = 1 // Don't change WHITE = 2 // these now )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgogoBoard ¶
type Board ¶
type Board struct {
// contains filtered or unexported fields
}
Board represetns a board.
The board was originally implemented with a *tensor.Dense. However it turns out that if many iterations of the board were needed, we would quite quickly run out of memory because the *tensor.Dense data structure is quite huge.
Given we know the stride of the board, a decision was made to cull the fat from the data structure.
type GTPBoard ¶
type GTPBoard struct { State [][]int Ko Point Size int Komi float64 NextPlayer int CapsByBlack int CapsByWhite int }
func NewGTPBoard ¶
func (*GTPBoard) AllLegalMoves ¶
func (*GTPBoard) GroupHasLiberties ¶
func (*GTPBoard) StringFromPoint ¶
func (*GTPBoard) StringFromXY ¶
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game implements game.State and mcts.GameState
func (*Game) ActionSpace ¶
func (*Game) AdditionalScore ¶
func (*Game) LastMove ¶
func (g *Game) LastMove() game.PlayerMove
func (*Game) MoveNumber ¶
func (*Game) UndoLastMove ¶
func (g *Game) UndoLastMove()