mnk

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Pass = game.Single(-1)

	Cross  = game.Player(game.Black)
	Nought = game.Player(game.White)
)

Functions

This section is empty.

Types

type MNK

type MNK struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MNK is a representation of M,N,K games - a game is played on a MxN board. K moves to win.

func New

func New(m, n, k int) *MNK

New creates a new MNK game

func TicTacToe

func TicTacToe() *MNK

TicTacToe creates a new MNK game for Tic Tac Toe

func (*MNK) ActionSpace

func (g *MNK) ActionSpace() int

func (*MNK) AdditionalScore

func (g *MNK) AdditionalScore() float32

AdditionalScore returns 0 always. No Komi

func (*MNK) Apply

func (g *MNK) Apply(m game.PlayerMove) game.State

func (*MNK) Board

func (g *MNK) Board() []game.Colour

func (*MNK) BoardSize

func (g *MNK) BoardSize() (int, int)

func (*MNK) Check

func (g *MNK) Check(m game.PlayerMove) bool

func (*MNK) Clone

func (g *MNK) Clone() game.State

func (*MNK) Ended

func (g *MNK) Ended() (ended bool, winner game.Player)

Ended checks if the game has ended. If it has, who is the winner?

func (*MNK) Eq

func (g *MNK) Eq(other game.State) bool

func (*MNK) Format

func (g *MNK) Format(s fmt.State, c rune)

func (*MNK) Fwd

func (g *MNK) Fwd()

func (*MNK) Handicap

func (g *MNK) Handicap() int

Handicap always returns 0.

func (*MNK) Hash

func (g *MNK) Hash() game.Zobrist

func (*MNK) Historical

func (g *MNK) Historical(i int) []game.Colour

func (*MNK) LastMove

func (g *MNK) LastMove() game.PlayerMove

func (*MNK) MoveNumber

func (g *MNK) MoveNumber() int

func (*MNK) Passes

func (g *MNK) Passes() int

Passes always returns -1. You can't pass in tic-tac-toe

func (*MNK) Reset

func (g *MNK) Reset()

func (*MNK) Score

func (g *MNK) Score(p game.Player) float32

func (*MNK) SetToMove

func (g *MNK) SetToMove(p game.Player)

func (*MNK) ToMove

func (g *MNK) ToMove() game.Player

func (*MNK) UndoLastMove

func (g *MNK) UndoLastMove()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL