state

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

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

func New

func New(graph godip.Graph, phase godip.Phase, backupRule godip.BackupRule, neutralOrders func(State) map[godip.Province]godip.Adjudicator) *State

func (*State) AddBounce

func (self *State) AddBounce(src, dst godip.Province)

func (*State) Bounce

func (self *State) Bounce(src, dst godip.Province) bool

func (*State) ClearBounces

func (self *State) ClearBounces()

func (*State) ClearDislodgers

func (self *State) ClearDislodgers()

func (*State) Dislodged

func (self *State) Dislodged(prov godip.Province) (u godip.Unit, p godip.Province, ok bool)

func (*State) Dislodgeds

func (self *State) Dislodgeds() map[godip.Province]godip.Unit

func (*State) Dump

func (self *State) Dump() (
	units map[godip.Province]godip.Unit,
	supplyCenters map[godip.Province]godip.Nation,
	dislodgeds map[godip.Province]godip.Unit,
	dislodgers map[godip.Province]godip.Province,
	bounces map[godip.Province]map[godip.Province]bool,
	resolutions map[godip.Province]error)

func (*State) Find

func (self *State) Find(filter godip.StateFilter) (provinces []godip.Province, orders []godip.Order, units []*godip.Unit)

func (*State) GetProfile

func (self *State) GetProfile() (map[string]time.Duration, map[string]int)

func (*State) Graph

func (self *State) Graph() godip.Graph

func (*State) Load

func (self *State) Load(
	units map[godip.Province]godip.Unit,
	supplyCenters map[godip.Province]godip.Nation,
	dislodgeds map[godip.Province]godip.Unit,
	dislodgers map[godip.Province]godip.Province,
	bounces map[godip.Province]map[godip.Province]bool,
	orders map[godip.Province]godip.Adjudicator) *State

func (*State) MemoizeProvSlice

func (self *State) MemoizeProvSlice(key string, f func() []godip.Province) []godip.Province

func (*State) Move

func (self *State) Move(src, dst godip.Province, preventRetreat bool)

func (*State) Next

func (self *State) Next() (err error)

func (*State) Options

func (self *State) Options(orders []godip.Order, nation godip.Nation) (result godip.Options)

func (*State) Order

func (self *State) Order(prov godip.Province) (o godip.Order, p godip.Province, ok bool)

func (*State) Orders

func (self *State) Orders() map[godip.Province]godip.Adjudicator

func (*State) Phase

func (self *State) Phase() godip.Phase

func (*State) Profile

func (self *State) Profile(a string, t time.Time)

func (*State) RemoveDislodged

func (self *State) RemoveDislodged(prov godip.Province)

func (*State) RemoveUnit

func (self *State) RemoveUnit(prov godip.Province)

func (*State) Resolutions

func (self *State) Resolutions() map[godip.Province]error

func (*State) Retreat

func (self *State) Retreat(src, dst godip.Province) (err error)

func (*State) SetDislodged

func (self *State) SetDislodged(prov godip.Province, unit godip.Unit) (err error)

func (*State) SetDislodgeds

func (self *State) SetDislodgeds(dislodgeds map[godip.Province]godip.Unit) (err error)

func (*State) SetDislodger

func (self *State) SetDislodger(attacker, victim godip.Province)

func (*State) SetOrder

func (self *State) SetOrder(prov godip.Province, order godip.Adjudicator) (err error)

func (*State) SetOrders

func (self *State) SetOrders(orders map[godip.Province]godip.Adjudicator)

func (*State) SetResolution

func (self *State) SetResolution(p godip.Province, err error)

func (*State) SetSC

func (self *State) SetSC(p godip.Province, n godip.Nation)

func (*State) SetSupplyCenters

func (self *State) SetSupplyCenters(supplyCenters map[godip.Province]godip.Nation) *State

func (*State) SetUnit

func (self *State) SetUnit(prov godip.Province, unit godip.Unit) (err error)

func (*State) SetUnits

func (self *State) SetUnits(units map[godip.Province]godip.Unit) (err error)

func (*State) SupplyCenter

func (self *State) SupplyCenter(prov godip.Province) (n godip.Nation, p godip.Province, ok bool)

func (*State) SupplyCenters

func (self *State) SupplyCenters() map[godip.Province]godip.Nation

func (*State) Unit

func (self *State) Unit(prov godip.Province) (u godip.Unit, p godip.Province, ok bool)

func (*State) Units

func (self *State) Units() map[godip.Province]godip.Unit

Jump to

Keyboard shortcuts

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