gums

package module
v0.0.0-...-7e8a158 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const W = 8

The grid is 8x8 == 64 cells

Variables

This section is empty.

Functions

func Choose

func Choose(s *State, player Player, depth int) (canMove bool, move position, desirability float64)

Choose returns the best move *for this player*, the desirability of the outcome *for this player*, and whether a move *by this player* is possible at all. The desirability is computed even if this player can't move

func Desirability

func Desirability(s *State, player Player) float64

func Eval

func Eval(s *State) (green float64, red float64)

Eval computes a "desirability" of a given state, for each player. This is not the same as the final score, where each cell counts for 1.

Types

type Content

type Content int
const (
	Empty Content = iota
	Green
	Red
)

func (Content) String

func (c Content) String() string

type Player

type Player = Content

func (Player) Opponent

func (player Player) Opponent() Player

type State

type State [W][W]Content

func InitialState

func InitialState() State

func (*State) CanCapture

func (s *State) CanCapture(player Player, pos position, dir direction) bool

func (*State) CanPlay

func (s *State) CanPlay(player Player, pos position) bool

func (*State) Capture

func (s *State) Capture(player Player, pos position, dir direction) int

func (*State) Play

func (s *State) Play(player Player, pos position) State

func (*State) PossibleMoves

func (s *State) PossibleMoves(player Player) (options []position)

func (*State) Score

func (s *State) Score() (green int, red int)

func (*State) String

func (s *State) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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