game

package
v0.0.0-...-351bd47 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Board

type Board struct {
	WhitePositions HexSet `json:"whitePositions"`
	BlackPositions HexSet `json:"blackPositions"`
	EdgeLength     int    `json:"edgeLength"`
}

type Direction

type Direction int
const (
	NullDirection Direction = iota
	TopRight
	MidRight
	BotRight
	BotLeft
	MidLeft
	TopLeft
)

type Hex

type Hex struct {
	Q int `json:"q"`
	R int `json:"r"`
}

type HexSet

type HexSet map[Hex]struct{}

func (HexSet) MarshalJSON

func (s HexSet) MarshalJSON() ([]byte, error)

func (*HexSet) UnmarshalJSON

func (s *HexSet) UnmarshalJSON(data []byte) error

type Move

type Move struct {
	// contains filtered or unexported fields
}

type Outcome

type Outcome int
const (
	NullOutcome Outcome = iota
	WhiteWins
	BlackWins
	Tie
)

func (Outcome) Loser

func (o Outcome) Loser() Player

func (Outcome) String

func (o Outcome) String() string

func (Outcome) Winner

func (o Outcome) Winner() Player

type Player

type Player int
const (
	NullPlayer Player = iota
	White
	Black
)

func (Player) Loses

func (p Player) Loses() Outcome

func (Player) MarshalJSON

func (p Player) MarshalJSON() ([]byte, error)

func (Player) Next

func (p Player) Next() Player

func (Player) String

func (p Player) String() string

func (*Player) UnmarshalJSON

func (p *Player) UnmarshalJSON(data []byte) error

func (Player) Wins

func (p Player) Wins() Outcome

type Segment

type Segment struct {
	// contains filtered or unexported fields
}

type State

type State struct {
	Board          Board  `json:"board"`
	NextPlayer     Player `json:"nextPlayer"`
	MovesRemaining int    `json:"movesRemaining"`
	MarblesPerMove int    `json:"marblesPerMove"`
	LossThreshold  int    `json:"lossThreshold"`
}
var Standard State = State{
	Board:          standardBoard,
	NextPlayer:     White,
	MovesRemaining: 1000,
	MarblesPerMove: 3,
	LossThreshold:  8,
}

func (*State) Equal

func (g1 *State) Equal(g2 *State) bool

func (*State) Futures

func (g *State) Futures() []*State

func (*State) GameOver

func (g *State) GameOver() bool

func (*State) NumPieces

func (g *State) NumPieces(p Player) int

func (*State) Outcome

func (g *State) Outcome() Outcome

func (*State) Update

func (g *State) Update(m *Move) State

like all functions in this implementation, this returns a copy if given an invalid move, behavior is undefined

func (*State) ValidFuture

func (g1 *State) ValidFuture(g2 *State) bool

Jump to

Keyboard shortcuts

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