Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct { Units int PlayerId PlayerId Reason ChangeReason }
type ChangeReason ¶
type ChangeReason string
type Edge ¶
type Edge struct { // Src is the id of the source node. Src NodeId // Dst is the id of the destination node. Dst NodeId // Units contains the units in transit along the edge. Units []map[PlayerId]int }
Edge goes from one node to another.
type Node ¶
type Node struct { // Id is the id of the node Id NodeId // Size is the number of units supported by the node. If less units, from a single player, occupy the node they will procreate. If more units occupy the node they will starve. Size int // Units contain the number of units for each player occupying this node. Units map[PlayerId]int // Edges go from this node to others. Edges map[NodeId]Edge }
Nodes contain units, and are connected by edges.
func RandomNode ¶
func RandomNode() (result *Node)
RandomNode returns a random node without connections.
type Order ¶
type Order struct { // Src is from where the units should move. Src NodeId // Dst is where the units should move. Dst NodeId // Units is the number of units to move. Units int }
Order contains a single order from an AI.
Orders will start units moving along edges of nodes, and they will be unorderable until they arrive.
type PathFilter ¶
PathFilter will return if a node is accepted by the filter.
type State ¶
type State struct { // Nodes are the nodes in the game. Nodes map[NodeId]*Node // Changes are the changes and reasons since last turn. Changes map[NodeId]Changes // Orders from each player Orders map[PlayerId]Orders }
State completely describes a single turn of the game.
func RandomState ¶
RandomState creates a random state for the provided players.
Click to show internal directories.
Click to hide internal directories.