nucleation 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/TickSimulation.d.mts +29 -0
- package/TickSimulation.d.ts +29 -0
- package/TickSimulation.mjs +69 -0
- package/nucleation.wasm +0 -0
- package/package.json +1 -1
package/TickSimulation.d.mts
CHANGED
|
@@ -309,4 +309,33 @@ export class TickSimulation {
|
|
|
309
309
|
changesCount(): number;
|
|
310
310
|
|
|
311
311
|
worldSnapshotJson(): string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Static structural analysis of the build standing in this world.
|
|
315
|
+
*
|
|
316
|
+
* One call, one JSON document: adhesion groups, piston/observer/source
|
|
317
|
+
* nodes, the four edge kinds, every minimal self-translating subgraph
|
|
318
|
+
* (the engine), payload, kickers, dead weight, and any proof that the
|
|
319
|
+
* machine cannot move.
|
|
320
|
+
*
|
|
321
|
+
* The analysis lives in the engine rather than in the caller on
|
|
322
|
+
* purpose. Every "what would this piston move?" answer comes from
|
|
323
|
+
* `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
|
|
324
|
+
* tick loop runs — and a second copy of Minecraft's push rules written
|
|
325
|
+
* on the far side of this boundary would drift from it silently.
|
|
326
|
+
*/
|
|
327
|
+
machineGraphJson(): string;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* GA pre-filter: static verdicts for a whole batch of genomes.
|
|
331
|
+
*
|
|
332
|
+
* Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
|
|
333
|
+
* immediately before it: whatever this rejects never needs simulating.
|
|
334
|
+
* Writes one row per genome, `[rejected, rejected_for_sustained,
|
|
335
|
+
* engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
|
|
336
|
+
*
|
|
337
|
+
* The registry, behaviour table and movability rules are built once for
|
|
338
|
+
* the batch — building them per genome costs more than the analysis.
|
|
339
|
+
*/
|
|
340
|
+
static machineGraphBatchJson(bx: number, by: number, bz: number, travel: number, xOff: number, palette: string, cells: Array<number>, airIndex: number): string;
|
|
312
341
|
}
|
package/TickSimulation.d.ts
CHANGED
|
@@ -309,4 +309,33 @@ export class TickSimulation {
|
|
|
309
309
|
changesCount(): number;
|
|
310
310
|
|
|
311
311
|
worldSnapshotJson(): string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Static structural analysis of the build standing in this world.
|
|
315
|
+
*
|
|
316
|
+
* One call, one JSON document: adhesion groups, piston/observer/source
|
|
317
|
+
* nodes, the four edge kinds, every minimal self-translating subgraph
|
|
318
|
+
* (the engine), payload, kickers, dead weight, and any proof that the
|
|
319
|
+
* machine cannot move.
|
|
320
|
+
*
|
|
321
|
+
* The analysis lives in the engine rather than in the caller on
|
|
322
|
+
* purpose. Every "what would this piston move?" answer comes from
|
|
323
|
+
* `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
|
|
324
|
+
* tick loop runs — and a second copy of Minecraft's push rules written
|
|
325
|
+
* on the far side of this boundary would drift from it silently.
|
|
326
|
+
*/
|
|
327
|
+
machineGraphJson(): string;
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* GA pre-filter: static verdicts for a whole batch of genomes.
|
|
331
|
+
*
|
|
332
|
+
* Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
|
|
333
|
+
* immediately before it: whatever this rejects never needs simulating.
|
|
334
|
+
* Writes one row per genome, `[rejected, rejected_for_sustained,
|
|
335
|
+
* engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
|
|
336
|
+
*
|
|
337
|
+
* The registry, behaviour table and movability rules are built once for
|
|
338
|
+
* the batch — building them per genome costs more than the analysis.
|
|
339
|
+
*/
|
|
340
|
+
static machineGraphBatchJson(bx: number, by: number, bz: number, travel: number, xOff: number, palette: string, cells: Array<number>, airIndex: number): string;
|
|
312
341
|
}
|
package/TickSimulation.mjs
CHANGED
|
@@ -822,6 +822,75 @@ export class TickSimulation {
|
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
+
/**
|
|
826
|
+
* Static structural analysis of the build standing in this world.
|
|
827
|
+
*
|
|
828
|
+
* One call, one JSON document: adhesion groups, piston/observer/source
|
|
829
|
+
* nodes, the four edge kinds, every minimal self-translating subgraph
|
|
830
|
+
* (the engine), payload, kickers, dead weight, and any proof that the
|
|
831
|
+
* machine cannot move.
|
|
832
|
+
*
|
|
833
|
+
* The analysis lives in the engine rather than in the caller on
|
|
834
|
+
* purpose. Every "what would this piston move?" answer comes from
|
|
835
|
+
* `resolve_push`/`resolve_pull` — the same oracle-verified resolver the
|
|
836
|
+
* tick loop runs — and a second copy of Minecraft's push rules written
|
|
837
|
+
* on the far side of this boundary would drift from it silently.
|
|
838
|
+
*/
|
|
839
|
+
machineGraphJson() {
|
|
840
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
841
|
+
|
|
842
|
+
wasm.TickSimulation_machine_graph_json(this.ffiValue, write.buffer);
|
|
843
|
+
|
|
844
|
+
try {
|
|
845
|
+
return write.readString8();
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
finally {
|
|
849
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
850
|
+
write.free();
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* GA pre-filter: static verdicts for a whole batch of genomes.
|
|
856
|
+
*
|
|
857
|
+
* Same flat-cell layout as {@link Self::eval_flight_batch}, and meant to run
|
|
858
|
+
* immediately before it: whatever this rejects never needs simulating.
|
|
859
|
+
* Writes one row per genome, `[rejected, rejected_for_sustained,
|
|
860
|
+
* engine_cell_count, payload_cell_count, dead_cell_count, "codes"]`.
|
|
861
|
+
*
|
|
862
|
+
* The registry, behaviour table and movability rules are built once for
|
|
863
|
+
* the batch — building them per genome costs more than the analysis.
|
|
864
|
+
*/
|
|
865
|
+
static machineGraphBatchJson(bx, by, bz, travel, xOff, palette, cells, airIndex) {
|
|
866
|
+
let functionCleanupArena = new diplomatRuntime.CleanupArena();
|
|
867
|
+
|
|
868
|
+
const paletteSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.str8(wasm, palette)));
|
|
869
|
+
const cellsSlice = functionCleanupArena.alloc(diplomatRuntime.DiplomatBuf.sliceWrapper(wasm, diplomatRuntime.DiplomatBuf.slice(wasm, cells, "u16")));
|
|
870
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
871
|
+
|
|
872
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
const result = wasm.TickSimulation_machine_graph_batch_json(diplomatReceive.buffer, bx, by, bz, travel, xOff, paletteSlice.ptr, cellsSlice.ptr, airIndex, write.buffer);
|
|
876
|
+
|
|
877
|
+
try {
|
|
878
|
+
if (!diplomatReceive.resultFlag) {
|
|
879
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
880
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
881
|
+
}
|
|
882
|
+
return write.readString8();
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
finally {
|
|
886
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
887
|
+
functionCleanupArena.free();
|
|
888
|
+
|
|
889
|
+
diplomatReceive.free();
|
|
890
|
+
write.free();
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
825
894
|
constructor(symbol, ptr, selfEdge) {
|
|
826
895
|
return this.#internalConstructor(...arguments)
|
|
827
896
|
}
|
package/nucleation.wasm
CHANGED
|
Binary file
|