route

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package route plans an efficient order for a character's quest stops: pick-ups, objectives and turn-ins, with map coordinates. The order comes from a deterministic optimiser (Held-Karp up to ExactMax stops, then nearest-neighbour improved by order-respecting 2-opt and or-opt), never from a language model. The rules are in docs/plan-format.md.

Index

Constants

View Source
const (
	MaxSteps    = 20  // stops on the route; the rest go to "later"
	MaxLater    = 30  // stops listed in "later"
	LevelMargin = 1   // a quest above the player's level + this goes to "later"
	MergeRadius = 3.0 // objective stops this close (map percent) on one map are one stop
	ClusterSize = 8.0 // spawns this close (map percent) are one cluster

)

Limits.

View Source
const (
	KindPickup    = "pickup"
	KindObjective = "objective"
	KindTurnIn    = "turnin"
	KindTravel    = "travel"
)

Stop kinds.

View Source
const ExactMax = 12

ExactMax is the most stops solved exactly; larger routes use the heuristic.

View Source
const File = "Plan.lua"

File is the file name, next to Digest.lua.

View Source
const Schema = "1.0"

Schema is the Plan.lua format version (docs/plan-format.md).

Variables

This section is empty.

Functions

func Lines

func Lines(p Plan, limit int) (lines []string, summary string)

Lines is the plan as short numbered lines for the overlay, with a one-line summary.

func Render

func Render(p Plan, limit int) string

Render is the plan as plain text for a prompt: the first limit steps and a count.

func Solve

func Solve(p *Problem, seeds ...[]int) []int

Solve returns the best order found. seeds are extra feasible orders to start the heuristic from (for example the naive quest-by-quest order); the result is never longer than any of them.

Types

type Envelope

type Envelope struct {
	Generated int64
	Plans     []Plan
}

Envelope is the whole file: one plan per character.

func (Envelope) Lua

func (e Envelope) Lua() string

Lua renders the one data-only `WoWCompanionPlan = {...}` assignment.

type Node

type Node struct {
	X, Y float64
	Pred []int
}

Node is one place to visit. Pred lists the indexes of nodes that must come first.

type Plan

type Plan struct {
	Character string   `json:"character"`
	Zone      string   `json:"zone,omitempty"`
	Start     *Point   `json:"start,omitempty"`
	Steps     []Stop   `json:"steps"`
	Later     []Stop   `json:"later,omitempty"`
	Distance  float64  `json:"distance"`       // route length in map percent
	Naive     float64  `json:"naive_distance"` // the quest-by-quest order's length, for comparison
	Total     int      `json:"total"`          // stops on the route, a travel stop included
	Notes     []string `json:"notes,omitempty"`
}

Plan is the ordered route for one character.

func Build

func Build(c character.Character, qx *questie.Index) Plan

Build plans c's route from the player's own QuestieDB. A nil index or a character with no level gives an empty plan with a note saying why.

type Point

type Point struct {
	Map int     `json:"map"`
	X   float64 `json:"x"`
	Y   float64 `json:"y"`
}

Point is a place on a map, in map percent.

type Problem

type Problem struct {
	Nodes []Node
	Start *[2]float64
	// Scale multiplies a distance (map percent to yards, say); 0 means 1. It does not change the order
	// on a single map, only the reported length.
	Scale float64
}

Problem is an open path from Start (nil: free start) through every node, respecting Pred.

func (*Problem) Feasible

func (p *Problem) Feasible(order []int) bool

Feasible reports whether order visits every node once with each node after its predecessors.

func (*Problem) Length

func (p *Problem) Length(order []int) float64

Length is the path length of order, in map percent (before Scale).

type Stop

type Stop struct {
	N       int     `json:"n"`
	Kind    string  `json:"kind"`
	QuestID int     `json:"quest_id,omitempty"`
	Quest   string  `json:"quest,omitempty"`
	Label   string  `json:"label"`
	Map     int     `json:"map"`
	X       float64 `json:"x"`
	Y       float64 `json:"y"`
	Done    bool    `json:"done"`
}

Stop is one place on the route.

Jump to

Keyboard shortcuts

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