orders

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildAnyHomeCenterOrder = &build{
	flags: map[godip.Flag]bool{
		godip.AnyHomeCenter: true,
	},
}
View Source
var BuildAnywhereOrder = &build{
	flags: map[godip.Flag]bool{
		godip.Anywhere: true,
	},
}
View Source
var BuildOrder = &build{}
View Source
var ConvoyOrder = &convoy{}
View Source
var DisbandOrder = &disband{}
View Source
var HoldOrder = &hold{}
View Source
var MoveOrder = &move{}
View Source
var MoveViaConvoyOrder = &move{
	flags: map[godip.Flag]bool{
		godip.ViaConvoy: true,
	},
}
View Source
var SupportOrder = &support{}

Functions

func AdjustmentStatus

func AdjustmentStatus(v godip.Validator, me godip.Nation) (builds godip.Orders, disbands godip.Orders, balance int)

func AnyConvoyPath

func AnyConvoyPath(v godip.Validator, src, dst godip.Province, resolveConvoys bool, viaNation *godip.Nation) (result []godip.Province)

func AnyMovePossible

func AnyMovePossible(v godip.Validator, typ godip.UnitType, src, dst godip.Province, lax, allowConvoy, resolveConvoys bool) (dstCoast godip.Province, err error)

func AnySupportPossible

func AnySupportPossible(v godip.Validator, typ godip.UnitType, src, dst godip.Province) (err error)

func Build

func Build(source godip.Province, typ godip.UnitType, at time.Time) *build

func BuildAnyHomeCenter

func BuildAnyHomeCenter(source godip.Province, typ godip.UnitType, at time.Time) *build

func BuildAnywhere

func BuildAnywhere(source godip.Province, typ godip.UnitType, at time.Time) *build

func Convoy

func Convoy(source, from, to godip.Province) *convoy

func ConvoyEndPoints

func ConvoyEndPoints(v godip.Validator, startPoint godip.Province, reverse bool, noConvoy *godip.Province) (result []godip.Province)

ConvoyEndPoints returns all possible end points for a convoy route starting at startPoint. If reverse is false then the route will be for a unit moving from startPoint; if it's true then the route will be for a unit moving to startPoint instead. If noConvoy is set then the route cannot pass through it.

func ConvoyParticipationPossible

func ConvoyParticipationPossible(v godip.Validator, participant, endpoint godip.Province) []godip.Province

ConvoyParticipantionPossible returns a path that participant (assumed to be a fleet at a convoyable position) could send an army to endpoint.

func ConvoyPathPossibleVia

func ConvoyPathPossibleVia(v godip.Validator, via, src, dst godip.Province, resolveConvoys bool) []godip.Province

func Disband

func Disband(source godip.Province, at time.Time) *disband

func HasEdge

func HasEdge(v godip.Validator, typ godip.UnitType, src, dst godip.Province) bool

func Hold

func Hold(source godip.Province) *hold

func HoldSupport

func HoldSupport(r godip.Resolver, prov godip.Province) int

HoldSupport returns successful supports of a hold in prov.

func Move

func Move(source, dest godip.Province) *move

func MoveSupport

func MoveSupport(r godip.Resolver, src, dst godip.Province, forbiddenSupports []godip.Nation) int

MoveSupport returns the successful supports of movement from src to dst, discounting the nations in forbiddenSupports.

func MustConvoy

func MustConvoy(r godip.Resolver, src godip.Province) bool

func PossibleConvoyPathFilter

func PossibleConvoyPathFilter(v godip.Validator, src, dst godip.Province, resolveConvoys, dstOk bool) godip.PathFilter

PossibleConvoyPathFilter returns a path filter for Graph that only accepts nodes that can partake in a convoy from src to dst. If resolveConvoys, then the convoys have to be successful. If dstOk then the dst is acceptable as convoying node.

func PossibleMoves

func PossibleMoves(v godip.Validator, src godip.Province, allowConvoy, dislodged bool) (result []godip.Province)

func PossibleMovesUnit

func PossibleMovesUnit(v godip.Validator, unitType godip.UnitType, start godip.Province, reverse bool, allowConvoy bool, noConvoy *godip.Province) (result []godip.Province)

PossibleMovesUnit returns the possible provinces that a unit can move to or from. If reverse is false then the unit must be in start, and if true then the potential units must be able to move to start. Setting allowConvoy allows convoy routes to be considered, and these must avoid the province noConvoy (if given).

func SupportHold

func SupportHold(prov, target godip.Province) *support

func SupportMove

func SupportMove(prov, from, to godip.Province) *support

Types

type MultiError

type MultiError []error

func (MultiError) Error

func (self MultiError) Error() string

type Parser

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

func NewParser

func NewParser(prototypes []godip.Order) Parser

func (Parser) OrderTypes

func (self Parser) OrderTypes() (result []godip.OrderType)

func (Parser) Orders

func (self Parser) Orders() (result []godip.Order)

func (Parser) Parse

func (self Parser) Parse(bits []string) (result godip.Adjudicator, err error)

func (Parser) ParseAll

func (self Parser) ParseAll(orders map[godip.Nation]map[godip.Province][]string) (result map[godip.Province]godip.Adjudicator, err error)

Jump to

Keyboard shortcuts

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