9ae7b88b89
Fuse the standalone ship-class designer (Phases 17/18) into a sidebar calculator: live mass/speed/attack/defence/bombing results, a planet build-rate readout, single-target goal-seek, a modernization-cost mode, and auto reach circles on the map for the selected planet. pkg/calc becomes the single source for the new math (no mirroring): extract BombingPower from the engine model and the per-turn ship-production loop from controller.ProduceShip into pkg/calc (engine now delegates), and add inverse goal-seek solvers in pkg/calc/solve.go. Thin-bridge the combat, planet-build, and solver functions through ui/core/calc + ui/wasm and rebuild core.wasm. Remove the standalone designer view/route; the ship-classes table and the view/bottom menus open the calculator via a shared request store. Docs: rewrite ui/PLAN.md Phase 30, adjust Phase 34 (realistic forecast + CAP/COL ownership), add ui/docs/calculator-ux.md, extend calc-bridge.md, fix navigation.md; remove ui/CALCULATOR.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
23 lines
1009 B
Go
23 lines
1009 B
Go
package calc
|
|
|
|
import "galaxy/calc"
|
|
|
|
// ShipBuildCost wraps `calc.ShipBuildCost` (`pkg/calc/planet.go`): the
|
|
// per-turn production cost of one ship of empty mass shipMass on a planet
|
|
// holding the given material stockpile at the given resources rating.
|
|
func ShipBuildCost(shipMass, material, resources float64) float64 {
|
|
return calc.ShipBuildCost(shipMass, material, resources)
|
|
}
|
|
|
|
// ProduceShipsInTurn wraps `calc.ProduceShipsInTurn`
|
|
// (`pkg/calc/planet.go`): one turn of ship production. It returns the
|
|
// whole ships completed this turn, the material left afterwards, the
|
|
// production units spent on the next (incomplete) ship, and that ship's
|
|
// progress fraction. The calculator's planet area renders ships-per-turn
|
|
// and turns-per-ship from this single call so it agrees with the engine.
|
|
func ProduceShipsInTurn(
|
|
productionAvailable, material, resources, shipMass float64,
|
|
) (uint, float64, float64, float64) {
|
|
return calc.ProduceShipsInTurn(productionAvailable, material, resources, shipMass)
|
|
}
|