Package dev.twilite.game.simulation
Class Simulation<I>
java.lang.Object
dev.twilite.game.simulation.Simulation<I>
- Type Parameters:
I- plugin-defined input for the current run
Generic bounded-node simulator for tick-based movement planning.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordBuilder for attaching ordered task rules to a simulation. -
Constructor Summary
ConstructorsConstructorDescriptionSimulation(SimulationOptions options, List<SimulationTask<? super I>> tasks) Creates a simulation with fixed options and ordered tasks that will shape each run. -
Method Summary
Modifier and TypeMethodDescriptionstatic <I> Simulation.Builder<I> create(SimulationOptions options) Starts a simulation builder with fixed bounds and movement options.Runs the simulation fromstartand returns the best reachable movement candidate.
-
Constructor Details
-
Simulation
Creates a simulation with fixed options and ordered tasks that will shape each run.- Parameters:
options- bounds and movement settingstasks- domain-specific rules applied in list order
-
-
Method Details
-
create
Starts a simulation builder with fixed bounds and movement options.- Parameters:
options- bounds and movement settings
-
run
Runs the simulation fromstartand returns the best reachable movement candidate.The planner expands reachable nodes, lets tasks reject movement through
SimulationTask.step(Object, SimulationGrid, Coord, Coord, int), applies task scoring throughSimulationTask.visit(I, dev.twilite.game.simulation.model.SimulationGrid, dev.twilite.game.simulation.model.SimulationNode), then picks the non-blocked, non-avoided node with the lowest penalty and highest score.- Parameters:
input- plugin-defined state for this runstart- start coordinate inside the simulation bounds- Returns:
- the chosen destination and first step, or empty when the start is outside bounds or no candidate is usable
-