Documentation ¶
Index ¶
- Constants
- func ArraysFill[T any](array []T, value T)
- func DistanceForVecs(Pos1 cfg.Vector, Pos2 cfg.Vector) float64
- func GetTimeMs(f *GameGraph, dist [][]int, keya string, keyb string) (cfg.MillisecondsI, error)
- func GetTimeMs2(f *GameGraph, dist [][]int, keya string, keyb string) cfg.MillisecondsI
- func ReverseSlice(s interface{})
- type DetailedPath
- type DijkstraAPSP
- type DijkstraOption
- type DijkstraResult
- type ExtraBase
- type GameGraph
- func (graph *GameGraph) DistanceToTime(distance float64, system_speed_multiplier float64) cfg.Milliseconds
- func (graph *GameGraph) GetPaths(parents [][]Parent, dist [][]int, source_key string, target_key string) []DetailedPath
- func (graph *GameGraph) GetTimeForDist(dist cfg.Milliseconds) cfg.Seconds
- func (f *GameGraph) SetEdge(keya string, keyb string, distance float64)
- func (f *GameGraph) SetIdsName(keya string, ids_name int)
- func (f *GameGraph) SetIstRadelane(keya string)
- func (g *GameGraph) WipeMatrix()
- type Item
- type MappingOptions
- type Neighbour
- type Parent
- type Path
- type PriorityQueue
- type RouteShipType
- type ShipSpeeds
- type SystemObject
- type VertexName
- type WithFreighterPaths
Constants ¶
const ( // Add for every pair of jumphole in path JumpHoleDelaySec = 15 // and jump gate // add for every tradelane vertex pair in path TradeLaneDockingDelaySec = 10 // add just once BaseDockingDelay = 10 )
const INF = math.MaxInt
const INFthreshold = math.MaxInt / 1000
const NO_PARENT = -1
const PrecisionMultipiler = cfg.Milliseconds(1000)
makes time in ms. Higher int value help having better calcs.
Variables ¶
This section is empty.
Functions ¶
func ArraysFill ¶
func ArraysFill[T any](array []T, value T)
func GetTimeMs2 ¶
Types ¶
type DetailedPath ¶
type DijkstraAPSP ¶
type DijkstraAPSP struct {
// contains filtered or unexported fields
}
func NewDijkstraApsp ¶
func NewDijkstraApsp(vertices int) *DijkstraAPSP
On using the below constructor, edges must be added manually to the graph using addEdge()
func NewDijkstraApspFromGraph ¶
func NewDijkstraApspFromGraph(graph *GameGraph, opts ...DijkstraOption) *DijkstraAPSP
func NewDijkstraApspFromMatrix ¶
func NewDijkstraApspFromMatrix(vertices int, adjacencyMatrix [][]int) *DijkstraAPSP
// On using the below constructor, // edges will be added automatically // to the graph using the adjacency matrix
func (*DijkstraAPSP) DijkstraApsp ¶
func (g *DijkstraAPSP) DijkstraApsp() ([][]int, [][]Parent)
type DijkstraOption ¶
type DijkstraOption func(graph *DijkstraAPSP)
func WithPathDistsForAllNodes ¶
func WithPathDistsForAllNodes() DijkstraOption
type DijkstraResult ¶
type DijkstraResult struct {
// contains filtered or unexported fields
}
type GameGraph ¶
type GameGraph struct { IndexByNick map[VertexName]int `json:"index_by_nickname"` NicknameByIndex map[int]VertexName `json:"nickname_by_index"` AllowedVertixesForCalcs map[VertexName]bool // Consider deleting this AvgCruiseSpeed int IsTradelane map[VertexName]bool CanVisitFreightersOnlyJHs WithFreighterPaths // contains filtered or unexported fields }
func MapConfigsToFGraph ¶
func MapConfigsToFGraph( configs *configs_mapped.MappedConfigs, avgCruiseSpeed int, with_freighter_paths WithFreighterPaths, extra_bases_by_system map[string][]ExtraBase, opts MappingOptions, ) *GameGraph
func NewGameGraph ¶
func NewGameGraph(avgCruiseSpeed int, canVisitFreighterOnlyJHs WithFreighterPaths) *GameGraph
func (*GameGraph) DistanceToTime ¶
func (graph *GameGraph) DistanceToTime(distance float64, system_speed_multiplier float64) cfg.Milliseconds
func (*GameGraph) GetTimeForDist ¶
func (graph *GameGraph) GetTimeForDist(dist cfg.Milliseconds) cfg.Seconds
func (*GameGraph) SetIdsName ¶
func (*GameGraph) SetIstRadelane ¶
func (*GameGraph) WipeMatrix ¶ added in v1.61.0
func (g *GameGraph) WipeMatrix()
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
An Item is something we manage in a priority queue.
type MappingOptions ¶
type MappingOptions struct {
TradeRoutesDetailedTradeLane *bool
}
Algorithm should be like this: We iterate through list of Systems: Adding all bases, jump gates, jump holes, tradelanes as Vertexes. We scan in advance nicknames for object on another side of jump gate/hole and add it as vertix We calculcate distances between them. Distance between jump connections is 0 (or time to wait measured in distance) We calculate distances between trade lanes as shorter than real distance for obvious reasons. The matrix built on a fight run will be having connections between vertixes as hashmaps of possible edges? For optimized memory consumption in a sparse matrix.
Then on second run, knowing amount of vertixes We build Floyd matrix? With allocating memory in bulk it should be rather rapid may be. And run Floud algorithm. Thus we have stuff calculated for distances between all possible trading locations. (edited) [6:02 PM] ==== Then we build table of Bases as starting points. And on click we show proffits of delivery to some location. With time of delivery. And profit per time. [6:02 PM] ==== Optionally print sum of two best routes that can be started within close range from each other.
type Neighbour ¶
type Neighbour struct {
// contains filtered or unexported fields
}
func NewNeighbour ¶
type PriorityQueue ¶
type PriorityQueue []*Item
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() any
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x any)
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type RouteShipType ¶
type RouteShipType int64
const ( RouteTransport RouteShipType = iota RouteFrigate RouteFreighter )
type ShipSpeeds ¶
type ShipSpeeds struct { AvgTransportCruiseSpeed int AvgFrigateCruiseSpeed int AvgFreighterCruiseSpeed int }
var DiscoverySpeeds ShipSpeeds = ShipSpeeds{
AvgTransportCruiseSpeed: 350,
AvgFrigateCruiseSpeed: 500,
AvgFreighterCruiseSpeed: 500,
}
var FLSRSpeeds ShipSpeeds = ShipSpeeds{
AvgTransportCruiseSpeed: 500,
AvgFrigateCruiseSpeed: 500,
AvgFreighterCruiseSpeed: 500,
}
var VanillaSpeeds ShipSpeeds = ShipSpeeds{
AvgTransportCruiseSpeed: 350,
AvgFrigateCruiseSpeed: 350,
AvgFreighterCruiseSpeed: 350,
}
type SystemObject ¶
type SystemObject struct {
// contains filtered or unexported fields
}
type VertexName ¶
type VertexName string
type WithFreighterPaths ¶
type WithFreighterPaths bool