orders

package
v0.1.93 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: GPL-3.0 Imports: 5 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 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 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

MustConvoy returns whether the unit at src must convoy. Used during adjudication to find mandatory convoy path, i.e. if there is no other option, or there is a convoy option and the move is via convoy, or the owner has told at least one fleet to convoy the unit that way.

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 ConvoyPathFilter added in v0.1.49

type ConvoyPathFilter struct {
	Validator   godip.Validator
	Source      godip.Province
	Destination godip.Province
	// If true, convoys will be resolved using Validator (cast to a Resolver)
	// to be considered OK.
	// Used during adjudication.
	ResolveConvoys bool
	// If true, destination will be checked the same way as every other step.
	// Used when validating convoy path _via_ provinces.
	DestinationMustConvoy bool
	// If not DestinationMustConvoy, i.e. destination is the landing point for the
	// convoyed unit, then the path up to the destination has to be at least
	// MinLengthAtDestination long for the step to destination to be OK.
	// Used to avoid finding convoy paths without any convoying fleets.
	MinLengthAtDestination int
	// If not nil, all fleets along the path have to be of this nation.
	// Used when warning about mismatched orders.
	OnlyNation *godip.Nation
	// If !ResolveConvoys, but VerifyConvoyOrderes, the participating fleets
	// need to at least give the convoy order to be considered OK.
	VerifyConvoyOrders bool
	// If set, this province will not be considered.
	// Used to find convoy paths not using a fleet attacked by someone supported
	// by the convoy target province, which is used to check if a support
	// is cut by the convoyed unit or not.
	AvoidProvince *godip.Province
}

func (ConvoyPathFilter) PathFilter added in v0.1.49

func (p ConvoyPathFilter) PathFilter(
	name godip.Province,
	edgeFlags,
	nodeFlags map[godip.Flag]bool,
	sc *godip.Nation,
	trace []godip.Province,
) bool

type ConvoyPathFinder added in v0.1.49

type ConvoyPathFinder struct {
	ConvoyPathFilter
	ViaNation   *godip.Nation
	ViaProvince *godip.Province
}

func (ConvoyPathFinder) Any added in v0.1.49

func (c ConvoyPathFinder) Any() []godip.Province

func (ConvoyPathFinder) Path added in v0.1.49

func (c ConvoyPathFinder) Path() []godip.Province

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