state

package
v0.0.0-...-c313fba Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edges

type Edges []edge

func (Edges) Len

func (a Edges) Len() int

func (Edges) Less

func (a Edges) Less(i, j int) bool

func (Edges) Swap

func (a Edges) Swap(i, j int)

type Empire

type Empire struct {
	Passive bool
	Planets []*Planet
	Fleets  []*Fleet
}

type Fleet

type Fleet struct {
	Empire       *Empire
	Position     *Planet
	LightSquads  int
	HeavySquads  int
	RangedSquads int
}

func (*Fleet) MergeFrom

func (fleet *Fleet) MergeFrom(from *Fleet)

func (*Fleet) Move

func (fleet *Fleet) Move(planet *Planet)

func (Fleet) Size

func (fleet Fleet) Size() int

type Graph

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

func NewGraph

func NewGraph(planets []*Planet) Graph

func (*Graph) GraphSize

func (g *Graph) GraphSize(root Node) int

func (*Graph) HasCycle

func (g *Graph) HasCycle(root *Planet) bool

func (*Graph) ShortestPath

func (g *Graph) ShortestPath(root *Planet, target *Planet, graphIsPrepared bool) []*Planet

func (*Graph) Visit

func (g *Graph) Visit(planet *Planet, f func(n Node) bool)

type Node

type Node struct {
	Planet *Planet
	// contains filtered or unexported fields
}

func (Node) Equal

func (a Node) Equal(b *Node) bool

type Planet

type Planet struct {
	PosX       uint32
	PosY       uint32
	Fleets     []*Fleet
	Control    float32
	Empire     *Empire
	Connected  []*Planet
	Production float32
}

func (*Planet) AddFleet

func (planet *Planet) AddFleet(fleet *Fleet)

func (Planet) Bounds

func (planet Planet) Bounds() *rtreego.Rect

func (Planet) EmpireFleet

func (planet Planet) EmpireFleet(empire *Empire) *Fleet

func (*Planet) RemoveFleet

func (planet *Planet) RemoveFleet(fleet *Fleet)

type Space

type Space struct {
	Fleets  []*Fleet
	Empires []*Empire
	Planets []*Planet

	Round int

	PlanetTree *rtreego.Rtree
	Graph      Graph
	Width      uint32
	Height     uint32
}

func EmptySpace

func EmptySpace() Space

func NewSpace

func NewSpace(empires int, planets uint32) Space

func (*Space) CreateEmpire

func (space *Space) CreateEmpire() *Empire

func (*Space) CreateFleet

func (space *Space) CreateFleet(planet *Planet, empire *Empire) *Fleet

func (*Space) CreatePlanet

func (space *Space) CreatePlanet(empire *Empire) *Planet

func (*Space) DestroyFleet

func (space *Space) DestroyFleet(fleet *Fleet)

func (*Space) Won

func (space *Space) Won() bool

Jump to

Keyboard shortcuts

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