Skip to content

Examples

Runnable examples, galleries and verification programs. Read these for usage patterns; their entry points are not a promise of a reusable box API.

221 source file(s), 699 public symbol(s), 310 of them carrying KDoc. Everything below is the documentation that lives beside the code — the same text the completion documentation panel shows in the editor. A blank summary means the declaration has no KDoc yet, not that this page dropped it.

AgentToolDemoEvidence.kt

src/jvmMain/kotlin/afield/examples/AgentToolDemoEvidence.kt — read the source

AgentToolDemoEvidence

object AgentToolDemoEvidence

Drives GeometryAgentTools end to end with no language model, and writes down exactly what a model would have been shown — which is the evidence behind public/docs/aiFeatures.md's "Give the AI a tool of your own".

Declaration Summary
fun main(args: Array<String>)

AgentTranscriptMaterializer.kt

src/jvmMain/kotlin/afield/examples/AgentTranscriptMaterializer.kt — read the source

AgentTranscriptMaterializer

object AgentTranscriptMaterializer

Turns every agent transcript under dev_docs/agents/transcripts/ into a loadable Field document — a <out>/<name>/metadata.edn scene an editor/welcome can open, run and edit. This is how the transcript corpus becomes both the docs gallery workspace and the welcome "starting points": one source of truth (the yaml), documents derived at build time.

Declaration Summary
fun main(args: Array<String>)

Ai4RateLimitRetrySmokeTest.kt

src/jvmMain/kotlin/afield/examples/Ai4RateLimitRetrySmokeTest.kt — read the source

Ai4RateLimitRetrySmokeTest

object Ai4RateLimitRetrySmokeTest

Declaration Summary
fun main(args: Array<String>)

BatchLaunchAnnotationSmokeTest.kt

src/jvmMain/kotlin/afield/examples/BatchLaunchAnnotationSmokeTest.kt — read the source

BatchLaunchAnnotationSmokeTest

object BatchLaunchAnnotationSmokeTest

Regression test: a box launched as part of a batch (a chord, or consecutive launch ops) must keep its "launching" run state continuously until its "launch" state takes over — it must never look idle in between.

Declaration Summary
fun main(args: Array<String>)

BatchLaunchSequencingSmokeTest.kt

src/jvmMain/kotlin/afield/examples/BatchLaunchSequencingSmokeTest.kt — read the source

BatchLaunchSequencingSmokeTest

object BatchLaunchSequencingSmokeTest

Regression test: a second chord fired while the first is still running must extend the launch sequence, not race it.

Declaration Summary
fun main(args: Array<String>)

BooleanNetworkExplorer.kt

src/jvmMain/kotlin/afield/examples/BooleanNetworkExplorer.kt — read the source

Top-level functions

Declaration Summary
fun regimeSweep(n: Int, ks: IntRange, seeds: IntRange): List<KauffmanRegimeRow>

BooleanNetworkExplorer

object BooleanNetworkExplorer

Console-oriented examples for the Boolean-network stdlib.

Declaration Summary
fun main(args: Array<String>)

KauffmanRegimeRow

data class KauffmanRegimeRow(val k: Int, val meanAttractorCount: Double, val meanPeriod: Double, val meanFixedPointCount: Double)

Declaration Summary
val k: Int
val meanAttractorCount: Double
val meanPeriod: Double
val meanFixedPointCount: Double

BooleanNetworkMusicSmokeTest.kt

src/jvmMain/kotlin/afield/examples/BooleanNetworkMusicSmokeTest.kt — read the source

BooleanNetworkMusicSmokeTest

object BooleanNetworkMusicSmokeTest

Declaration Summary
fun main(args: Array<String>)

BooleanNetworksSmokeTest.kt

src/jvmMain/kotlin/afield/examples/BooleanNetworksSmokeTest.kt — read the source

BooleanNetworksSmokeTest

object BooleanNetworksSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

BoxCodeCompileGuard.kt

src/jvmMain/kotlin/afield/examples/BoxCodeCompileGuard.kt — read the source

BoxCodeCompileGuard

object BoxCodeCompileGuard

The landing guard that box code still compiles: each named transcript goes down the path DemoTranscriptExecSmokeTest classifies it for. COMPILE_ONLY transcripts (the ones that would open a window) build their graph and compile with evaluation skipped; EXECUTE transcripts are headless-safe and run, because a later box may need what an earlier one defines when evaluated; KOTLINJS transcripts compile through the Kotlin/JS path.

Declaration Summary
fun main(args: Array<String>)

BoxCodeFormat.kt

src/jvmMain/kotlin/afield/examples/BoxCodeFormat.kt — read the source

BoxCodeFormat

object BoxCodeFormat

Formats the box code in transcripts and *_code_.kt sidecars with the formatter the editor uses (formatCodeProperty: ktfmt for code, Field's GLSL formatter for shader properties), in place.

Declaration Summary
fun main(args: Array<String>)
fun allCorpora(): List<File> Every corpus the formatter owns: transcripts, demo build scripts, tracked *_code_.kt sidecars outside GENERATED_ROOT, docs pages.
fun formatYaml(text: String, label: String): String
fun formatMarkdown(text: String, label: String): String Format the Kotlin in a docs page's diffstatic / diffstatic_runner fences, in place.

BoxImportCensus.kt

src/jvmMain/kotlin/afield/examples/BoxImportCensus.kt — read the source

BoxImportCensus

object BoxImportCensus

Reads the imports of every published box and reports what they are for. Writes nothing but its report: it changes no box.

Declaration Summary
fun main(args: Array<String>)

ClothSimulationExample.kt

src/jvmMain/kotlin/afield/examples/ClothSimulationExample.kt — read the source

ClothSimulationExample

object ClothSimulationExample

Demo of Cloth — the reusable grid-cloth builder over SimdVerlet's 4-slot distance constraints. All of the physics lives in Cloth now; what is left here is the part that is genuinely example-shaped: standing up a simulation, wrapping the frame loop so the grabbed particle gets a red crosshair, and the process-level "most recent simulation" handle that lets an interactive box call grabNearest without holding one.

Declaration Summary
class InteractiveClothSimulation internal constructor(val cloth: Cloth, val frames: Sequence<List<FLine>>) Interactive cloth simulation handle with externally callable grab controls.
fun grabNearest(worldX: Float, worldY: Float, worldZ: Float): Boolean Convenience passthrough for external callers that do not hold the simulation handle. Routes to the most recently created interactive simulation.
fun grabNearest(worldX: Float, worldY: Float): Boolean
fun moveGrabbed(worldX: Float, worldY: Float, worldZ: Float): Boolean
fun moveGrabbed(worldX: Float, worldY: Float): Boolean
fun releaseGrabbed(): Boolean
fun createClothSimulation(clothWidth: Int = 20, clothHeight: Int = 20, spacing: Float = 0.5f, enableCurvatureForce: Boolean = true, curvatureStrength: Float = 0.05f): Sequence<List<FLine>> Backward-compatible API that returns only the frame sequence.
fun createInteractiveClothSimulation(clothWidth: Int = 20, clothHeight: Int = 20, spacing: Float = 0.5f, enableCurvatureForce: Boolean = true, curvatureStrength: Float = 0.05f): InteractiveClothSimulation Create and run a cloth simulation with externally callable interaction controls.
fun main(args: Array<String>)

CodeUseTelemetryBusyRecoverySmokeTest.kt

src/jvmMain/kotlin/afield/examples/CodeUseTelemetryBusyRecoverySmokeTest.kt — read the source

CodeUseTelemetryBusyRecoverySmokeTest

object CodeUseTelemetryBusyRecoverySmokeTest

A second connection holds the telemetry database's write lock through two of the writer's 5 s busy timeouts. The writer must stay enabled, report the SQLITE_BUSY retries and the events it is holding, and commit every one of them once the lock is released. Analysis of a held compile event must wait for that commit.

Declaration Summary
fun main(args: Array<String>)

CodeUseTelemetrySidecarStoreSmokeTest.kt

src/jvmMain/kotlin/afield/examples/CodeUseTelemetrySidecarStoreSmokeTest.kt — read the source

CodeUseTelemetrySidecarStoreSmokeTest

object CodeUseTelemetrySidecarStoreSmokeTest

Declaration Summary
fun main(args: Array<String>)

CodeUseTelemetrySmokeTest.kt

src/jvmMain/kotlin/afield/examples/CodeUseTelemetrySmokeTest.kt — read the source

CodeUseTelemetrySmokeTest

object CodeUseTelemetrySmokeTest

Declaration Summary
fun main(args: Array<String>)

CompiledSnippetExample.kt

src/jvmMain/kotlin/afield/examples/CompiledSnippetExample.kt — read the source

CompiledSnippetExample

object CompiledSnippetExample

Simple example demonstrating the CompiledSnippet usage pattern.

Declaration Summary
fun main(args: Array<String>)

ContextLocalVariableShadowingSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ContextLocalVariableShadowingSmokeTest.kt — read the source

ContextLocalVariableShadowingSmokeTest

object ContextLocalVariableShadowingSmokeTest

Regression test for the self-pinning bug in fromContext (afield.document.context).

Declaration Summary
fun main(args: Array<String>)

ContextResolutionLedgerSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ContextResolutionLedgerSmokeTest.kt — read the source

ContextResolutionLedgerSmokeTest

object ContextResolutionLedgerSmokeTest

The live-engine half of ContextResolutionCharacterizationTest: the two resolution behaviours that only exist once a real box has run — a variable it really left behind, and a preamble line checkPreambleAndExecute really persisted.

Declaration Summary
fun main(args: Array<String>)

ContextSearchOrderLedgerSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ContextSearchOrderLedgerSmokeTest.kt — read the source

ContextSearchOrderLedgerSmokeTest

object ContextSearchOrderLedgerSmokeTest

The whole search order of fromContext (afield.document.context), staged live, one box per step, asserted in both directions.

Declaration Summary
fun main(args: Array<String>)

ContextWhySmoke.kt

src/jvmMain/kotlin/afield/examples/ContextWhySmoke.kt

CrossBoxContextInheritanceSmokeTest.kt

src/jvmMain/kotlin/afield/examples/CrossBoxContextInheritanceSmokeTest.kt — read the source

CrossBoxContextInheritanceSmokeTest

object CrossBoxContextInheritanceSmokeTest

Regression test for cross-box context inheritance via fromContextWithNameOrNull (afield.document.context).

Declaration Summary
fun main(args: Array<String>)

DemoTranscriptExecSmokeTest.kt

src/jvmMain/kotlin/afield/examples/DemoTranscriptExecSmokeTest.kt — read the source

DemoTranscriptExecSmokeTest

object DemoTranscriptExecSmokeTest

Verification-integrity harness: executes / compiles the box bodies of every shipped demo transcript under dev_docs/agents/transcripts/ and asserts they carry no diagnostics.

Declaration Summary
fun main(args: Array<String>)

DocsPanelCodeLinksSmokeTest.kt

src/jvmMain/kotlin/afield/examples/DocsPanelCodeLinksSmokeTest.kt — read the source

DocsPanelCodeLinksSmokeTest

object DocsPanelCodeLinksSmokeTest

Exercises the documentation-panel code-link backend against the real Kotlin source index (~/.afield/filestore/kotlin_source_index.json): KDoc Symbol linkification and source-card resolution. No GPU/UI — pure index + source reads — so it runs in a fresh JVM.

Declaration Summary
fun main(args: Array<String>)

DocsSearchRetrievalHarness.kt

src/jvmMain/kotlin/afield/examples/DocsSearchRetrievalHarness.kt — read the source

DocsSearchRetrievalHarness

object DocsSearchRetrievalHarness

A/B eyeball harness for the local docs-search retrieval path.

Declaration Summary
fun main(args: Array<String>)

DocumentGuideWorkout.kt

src/jvmMain/kotlin/afield/examples/DocumentGuideWorkout.kt — read the source

DocumentGuideWorkout

object DocumentGuideWorkout

Trusted browser input checks, marshalled onto the same dispatcher as Field's captures.

Declaration Summary
fun prepare()
fun checkGestures()

DocumentMarkdownSmokeTest.kt

src/jvmMain/kotlin/afield/examples/DocumentMarkdownSmokeTest.kt — read the source

DocumentMarkdownSmokeTest

object DocumentMarkdownSmokeTest

Declaration Summary
fun main(args: Array<String>)

DocumentOnDiskSmokeTest.kt

src/jvmMain/kotlin/afield/examples/DocumentOnDiskSmokeTest.kt — read the source

DocumentOnDiskSmokeTest

object DocumentOnDiskSmokeTest

Drives thirteen real SavingContext.save calls into a temp directory and prints what they leave.

Declaration Summary
fun main(args: Array<String>)
fun census(dir: File): String The second half of the figure: how many backups each artifact kept after thirteen saves.
fun listing(dir: File): String The figure. Names and backup indices only — no sizes and no timestamps, so the block is reproducible and can be pinned verbatim by DocumentOnDiskPageDriftGuard.

DocumentToTranscript.kt

src/jvmMain/kotlin/afield/examples/DocumentToTranscript.kt — read the source

DocumentToTranscript

object DocumentToTranscript

Writes an OperationTranscript yaml from a saved Field document — the reverse of AgentTranscriptMaterializer. It is how a document built by hand, or a nightly demo under dev_docs/agents/demos/, becomes a transcript in dev_docs/agents/transcripts/ without anyone retyping its boxes: the document is what the boxes currently contain, so the transcript is generated from it, never paraphrased.

Declaration Summary
class Result(val yaml: String, val boxes: Int, val omitted: List<String>, val notCarried: List<String>) What one conversion produced. omitted are things the transcript leaves out on purpose and says so in its header; notCarried are values this writer cannot spell, which the round trip treats as failures.
fun main(args: Array<String>)
fun convert(document: File, name: String = document.name): Result Load document in a fresh session and write its transcript.
fun roundTrip(document: File): List<String> Convert document, rebuild the transcript's graph through the real apply path, and list every difference between the rebuilt boxes and the loaded ones. Empty means the transcript is the document.

ExportedAcrossBatchLaunchSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ExportedAcrossBatchLaunchSmokeTest.kt — read the source

ExportedAcrossBatchLaunchSmokeTest

object ExportedAcrossBatchLaunchSmokeTest

Regression test: @exported must publish when a box is launched as part of a batch (a chord — alt-drag over several boxes — or consecutive launch ops in a transcript).

Declaration Summary
fun main(args: Array<String>)

ExportedAnnotationExample.kt

src/jvmMain/kotlin/afield/examples/ExportedAnnotationExample.kt — read the source

ExportedAnnotationExample

object ExportedAnnotationExample

Example demonstrating the @exported annotation feature.

Declaration Summary
fun main(args: Array<String>)

ExportedAnnotationTest.kt

src/jvmMain/kotlin/afield/examples/ExportedAnnotationTest.kt — read the source

ExportedAnnotationTest

object ExportedAnnotationTest

Test for @exported annotation functionality

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

FieldBackdoorCatalogExamples.kt

src/jvmMain/kotlin/afield/examples/FieldBackdoorCatalogExamples.kt

GeneratedLinalgSmokeTest.kt

src/jvmMain/kotlin/afield/examples/GeneratedLinalgSmokeTest.kt — read the source

GeneratedLinalgSmokeTest

object GeneratedLinalgSmokeTest

Declaration Summary
fun main(args: Array<String>)

GrowingGraphSimdVerletExample.kt

src/jvmMain/kotlin/afield/examples/GrowingGraphSimdVerletExample.kt — read the source

Top-level functions

Declaration Summary
fun main1(): Pair<FLine, FLine>
fun main()
fun growingSequence(): Sequence<Pair<FLine, FLine>>
fun growingSequenceInteractive(): GrowingSequenceRuntime

Top-level values

Declaration Summary
var lastBarnesHutFLine
var lastBarnesHutFLine_depth

SimdNodePick3D

data class SimdNodePick3D(val nodeIndex: Int, val queryPoint: afield.math.linalg.Vec3, val nodePosition: afield.math.linalg.Vec3, val distanceToNode: Float)

Declaration Summary
val nodeIndex: Int
val queryPoint: afield.math.linalg.Vec3
val nodePosition: afield.math.linalg.Vec3
val distanceToNode: Float

GrowingSequenceRuntime

class GrowingSequenceRuntime internal constructor(val frames: Sequence<Pair<FLine, FLine>>, private val grabFn: (queryPoint: afield.math.linalg.Vec3, controllerPosition: afield.math.linalg.Vec3, controllerRotation: Quat, maxOutsideDistance: Double) -> SimdNodePick3D?, private val continueFn: (controllerPosition: afield.math.linalg.Vec3, controllerRotation: Quat) -> Boolean, private val releaseFn: () -> Int?, private val grabbedNodeIndexFn: () -> Int?, private val closeFn: () -> Unit) : AutoCloseable

Declaration Summary
val frames: Sequence<Pair<FLine, FLine>>
fun grab(queryPoint: afield.math.linalg.Vec3, controllerPosition: afield.math.linalg.Vec3 = vec(queryPoint.x, queryPoint.y, queryPoint.z), controllerRotation: Quat = Quat(), maxOutsideDistance: Double = Double.POSITIVE_INFINITY): SimdNodePick3D?
fun grab(controllerPosition: afield.math.linalg.Vec3, controllerRotation: Quat, maxOutsideDistance: Double = Double.POSITIVE_INFINITY): SimdNodePick3D?
fun continueGrab(controllerPosition: afield.math.linalg.Vec3, controllerRotation: Quat): Boolean
fun `continue`(controllerPosition: afield.math.linalg.Vec3, controllerRotation: Quat): Boolean
fun release(): Int?
fun grabbedNodeIndex(): Int?
override fun close()

HistoryFileInlineSmokeTest.kt

src/jvmMain/kotlin/afield/examples/HistoryFileInlineSmokeTest.kt — read the source

HistoryFileInlineSmokeTest

object HistoryFileInlineSmokeTest

Declaration Summary
fun main(args: Array<String>)

JSONLineServerSmokeTest.kt

src/jvmMain/kotlin/afield/examples/JSONLineServerSmokeTest.kt — read the source

JSONLineServerSmokeTest

object JSONLineServerSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

JSONProcessSmokeTest.kt

src/jvmMain/kotlin/afield/examples/JSONProcessSmokeTest.kt — read the source

JSONProcessSmokeTest

object JSONProcessSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

JoltPhysicsExample.kt

src/jvmMain/kotlin/afield/examples/JoltPhysicsExample.kt — read the source

JoltPickupLoopRuntime

class JoltPickupLoopRuntime internal constructor(val frames: Sequence<List<FLine>>, private val grabFn: (queryPoint: Vec3, controllerPosition: Vec3, controllerRotation: Quat, maxOutsideDistance: Double) -> JoltBodyPick?, private val continueFn: (controllerPosition: Vec3, controllerRotation: Quat) -> Boolean, private val releaseFn: () -> String?, private val grabbedBodyNameFn: () -> String?, private val closeFn: () -> Unit) : AutoCloseable

Declaration Summary
val frames: Sequence<List<FLine>>
fun grab(queryPoint: Vec3, controllerPosition: Vec3 = Vec3(queryPoint), controllerRotation: Quat = Quat(), maxOutsideDistance: Double = 0.08): JoltBodyPick?
fun grab(controllerPosition: Vec3, controllerRotation: Quat, maxOutsideDistance: Double = 0.08): JoltBodyPick?
fun continueGrab(controllerPosition: Vec3, controllerRotation: Quat): Boolean
fun `continue`(controllerPosition: Vec3, controllerRotation: Quat): Boolean
fun release(): String?
fun grabbedBodyName(): String?
override fun close()

JoltPhysicsExample

object JoltPhysicsExample

Declaration Summary
fun main(args: Array<String>)
fun runStressTestChaos(seed: Int = 1337, bodyCount: Int = 20)
fun runStressTestPickupLoop(seed: Int = 1337, bodyCount: Int = 20, dt: Double = 1.0 / 120.0, floorPlaneHeight: Float = 0f): JoltPickupLoopRuntime

KotlinInTheHeadEvidence.kt

src/jvmMain/kotlin/afield/examples/KotlinInTheHeadEvidence.kt — read the source

KotlinInTheHeadEvidence

object KotlinInTheHeadEvidence

Regenerates the emitted-JavaScript evidence embedded in public/docs/kotlin_in_the_head.md.

Declaration Summary
fun main(args: Array<String>)

KotlinJsBindingParitySmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsBindingParitySmokeTest.kt — read the source

KotlinJsBindingParitySmokeTest

object KotlinJsBindingParitySmokeTest

Guards the invariants that motivated generating both façades from one binding model (afield.lang.remotejs.KotlinJsBinding): the compiler declarations and the completion mirror must agree. These are exactly the two discrepancies that hand-maintenance had produced.

Declaration Summary
fun main(args: Array<String>)

KotlinJsBoxSurfaceSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsBoxSurfaceSmokeTest.kt — read the source

KotlinJsBoxSurfaceSmokeTest

object KotlinJsBoxSurfaceSmokeTest

The Kotlin→JS half of dev_docs/REMOTEJS_BOX_PARITY.md: a // {{ remoteAR }} box compiles against display, slider, checkbox and setTimeout (bound to the head's field.js globals), and an exception thrown inside the Kotlin stdlib maps, through the module's source map, to the editor line of the box's own code rather than to the generated JavaScript line (an inline stdlib function marks the line that called the user function it was expanded into). The compiled module runs in Node with stand-ins for the head's globals and a real stack.

Declaration Summary
fun main(args: Array<String>)

KotlinJsCompletionSpikeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsCompletionSpikeTest.kt — read the source

KotlinJsCompletionSpikeTest

object KotlinJsCompletionSpikeTest

KotlinJS autocomplete: reuse the K2 Analysis-API completion, scoped to the Kotlin stdlib only (AaCompletionClient.kotlinStdlibRoots). What this asserts (the honest, measured behaviour):

Declaration Summary
fun main(args: Array<String>)

KotlinJsHeadProfilesSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsHeadProfilesSmokeTest.kt — read the source

KotlinJsHeadProfilesSmokeTest

object KotlinJsHeadProfilesSmokeTest

Marker parsing, fragment inheritance, compilation, and runtime global-name linking.

Declaration Summary
fun main(args: Array<String>)

KotlinJsLaunchStateSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsLaunchStateSmokeTest.kt — read the source

KotlinJsLaunchStateSmokeTest

object KotlinJsLaunchStateSmokeTest

Pure JVM coverage for multi-head terminal aggregation and per-strand lifecycle identity.

Declaration Summary
fun main(args: Array<String>)

KotlinJsRemoteArSurfaceSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsRemoteArSurfaceSmokeTest.kt — read the source

KotlinJsRemoteArSurfaceSmokeTest

object KotlinJsRemoteArSurfaceSmokeTest

Validates the expanded RemoteAR surface (math types + vec/clearAll + the dynamic-with-typed- completion stage) by compiling a sample that exercises it against the GENERATED compiler declarations — the real check that the binding model emits valid external Kotlin/JS for every new name and that they type-check together. Also asserts the dynamic (compiler) vs Stage (completion) split so stage.foo = x stays permissive while stage.add| gets completion.

Declaration Summary
fun main(args: Array<String>)

KotlinJsRemoteLifecycleSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsRemoteLifecycleSmokeTest.kt — read the source

KotlinJsRemoteLifecycleSmokeTest

object KotlinJsRemoteLifecycleSmokeTest

Executes compiled Kotlin/JS against the browser head's REAL runners.js lifecycle.

Declaration Summary
fun main(args: Array<String>)

KotlinJsSourcePreparationSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsSourcePreparationSmokeTest.kt — read the source

KotlinJsSourcePreparationSmokeTest

object KotlinJsSourcePreparationSmokeTest

Declaration Summary
fun main(args: Array<String>)

KotlinJsToneSurfaceSmokeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinJsToneSurfaceSmokeTest.kt — read the source

KotlinJsToneSurfaceSmokeTest

object KotlinJsToneSurfaceSmokeTest

Validates the Tone.js computer-music head profile (// {{ tone }}) by compiling a sample that exercises a broad slice of the surface against the GENERATED compiler external declarations — the real proof the ToneKotlinJs binding emits valid Kotlin/JS for every bound name and that they type-check together. Also asserts the marker routes to the tone profile and the parity/dynamic split invariants (afield.graphics.KotlinJsBinding) hold for the Tone surface.

Declaration Summary
fun main(args: Array<String>)

KotlinToJsBenchmark.kt

src/jvmMain/kotlin/afield/examples/KotlinToJsBenchmark.kt — read the source

KotlinToJsBenchmark

object KotlinToJsBenchmark

Measures warm, in-process compile latency for the two output profiles, to answer whether the whole-program DCE pass (PLAIN_DCE) adds meaningful per-edit latency versus per-module ES output that ships the stdlib once (ESM_SHARED). Prints median ms + output size for a trivial and a medium program. Not a pass/fail latency gate — just numbers.

Declaration Summary
fun main(args: Array<String>)

KotlinToJsSpikeTest.kt

src/jvmMain/kotlin/afield/examples/KotlinToJsSpikeTest.kt — read the source

KotlinToJsSpikeTest

object KotlinToJsSpikeTest

Proves the Kotlin->JS RemoteJS seam end to end, in-process from a Field JVM: 1. A self-contained Kotlin snippet that uses operator fun plus (the thing ASTA exists to fake in raw JS) compiles to a single plain-module JS string via KotlinToJsCompiler. 2. A deliberately broken snippet surfaces a structured compile diagnostic (line + message), i.e. errors are catchable at the Kotlin source before the browser ever runs anything. 3. If node is on PATH, the produced JS is actually executed and its output verified — proving the module is directly eval-able (which is what the head's global.eval(code) needs).

Declaration Summary
fun main(args: Array<String>)

LifecycleCensusSmoke.kt

src/jvmMain/kotlin/afield/examples/LifecycleCensusSmoke.kt

LinalgMicrobench.kt

src/jvmMain/kotlin/afield/examples/LinalgMicrobench.kt — read the source

LinalgMicrobench

object LinalgMicrobench

Declaration Summary
fun main(args: Array<String>)

LinalgSerializationSmokeTest.kt

src/jvmMain/kotlin/afield/examples/LinalgSerializationSmokeTest.kt — read the source

LinalgSerializationSmokeTest

object LinalgSerializationSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

MetadataNestedImportSmokeTest.kt

src/jvmMain/kotlin/afield/examples/MetadataNestedImportSmokeTest.kt — read the source

MetadataNestedImportSmokeTest

object MetadataNestedImportSmokeTest

Declaration Summary
fun main(args: Array<String>)

MslLanguageSmokeTest.kt

src/jvmMain/kotlin/afield/examples/MslLanguageSmokeTest.kt — read the source

MslLanguageSmokeTest

object MslLanguageSmokeTest

Drives the real msl.js under Node with the AMD loader and the slice of the Monaco API it touches mocked out, then asks the actual completion provider for suggestions.

Declaration Summary
fun main(args: Array<String>)

NotebookExportSmokeTest.kt

src/jvmMain/kotlin/afield/examples/NotebookExportSmokeTest.kt — read the source

NotebookExportSmokeTest

object NotebookExportSmokeTest

Declaration Summary
fun main(args: Array<String>)

NotebookImportSmokeTest.kt

src/jvmMain/kotlin/afield/examples/NotebookImportSmokeTest.kt — read the source

NotebookImportSmokeTest

object NotebookImportSmokeTest

Declaration Summary
fun main(args: Array<String>)

OperationTranscriptMacroSmokeTest.kt

src/jvmMain/kotlin/afield/examples/OperationTranscriptMacroSmokeTest.kt — read the source

OperationTranscriptMacroSmokeTest

object OperationTranscriptMacroSmokeTest

Declaration Summary
fun main(args: Array<String>)

OperationTranscriptPromoteSmokeTest.kt

src/jvmMain/kotlin/afield/examples/OperationTranscriptPromoteSmokeTest.kt — read the source

OperationTranscriptPromoteSmokeTest

object OperationTranscriptPromoteSmokeTest

Declaration Summary
fun main(args: Array<String>)

ProfilingPanelWorkout.kt

src/jvmMain/kotlin/afield/examples/ProfilingPanelWorkout.kt — read the source

ProfilingPanelWorkout

object ProfilingPanelWorkout

Browser regression helper; uses the same dedicated dispatcher as Field screenshot capture.

Declaration Summary
fun checkCorners()

ProvideDelegateReplSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ProvideDelegateReplSmokeTest.kt — read the source

ProvideDelegateReplSmokeTest

object ProvideDelegateReplSmokeTest

operator fun provideDelegate in Field's K2 REPL, in every position box code can put it — the box idiom var kc by keyCamera(camera=camera) (public/docs/afield_four_graphics.md:787) among them. This began as a characterization of two crashes; both are fixed, and it now asserts that every rung evaluates.

Declaration Summary
const val DEFECT_A Signature of the fork-side, top-level failure. See DEFECT_A.
const val DEFECT_B Signature of the Wither-plugin failure, fixed 2026-10-04. Its trigger was not provideDelegate and not local-ness: it was a call, as a statement, to a function with no callableId — here the setter of a property of an anonymous ReadWriteProperty. See dev_docs/k2_repl_provide_delegate.md.
fun runTests(): Boolean
fun main(args: Array<String>)

ReactivePropsSmoke.kt

src/jvmMain/kotlin/afield/examples/ReactivePropsSmoke.kt

RemoteJSDiagnosticSmokeTest.kt

src/jvmMain/kotlin/afield/examples/RemoteJSDiagnosticSmokeTest.kt — read the source

RemoteJSDiagnosticSmokeTest

object RemoteJSDiagnosticSmokeTest

Declaration Summary
fun main(args: Array<String>)

RemoteJSTemplateSmokeTest.kt

src/jvmMain/kotlin/afield/examples/RemoteJSTemplateSmokeTest.kt — read the source

RemoteJSTemplateSmokeTest

object RemoteJSTemplateSmokeTest

Declaration Summary
fun main(args: Array<String>)

RuntimeToggleMultiParentSmokeTest.kt

src/jvmMain/kotlin/afield/examples/RuntimeToggleMultiParentSmokeTest.kt — read the source

RuntimeToggleMultiParentSmokeTest

object RuntimeToggleMultiParentSmokeTest

Declaration Summary
fun main(args: Array<String>)

SemanticRetrievalSmokeTest.kt

src/jvmMain/kotlin/afield/examples/SemanticRetrievalSmokeTest.kt — read the source

SemanticRetrievalSmokeTest

object SemanticRetrievalSmokeTest

Declaration Summary
fun main(args: Array<String>)

SidecarPathParseSmokeTest.kt

src/jvmMain/kotlin/afield/examples/SidecarPathParseSmokeTest.kt — read the source

SidecarPathParseSmokeTest

object SidecarPathParseSmokeTest

Regression guard for the "dragging a macro spawns a spurious phantom box" bug.

Declaration Summary
fun main(args: Array<String>)

SidecarPropertyRegistrationSmokeTest.kt

src/jvmMain/kotlin/afield/examples/SidecarPropertyRegistrationSmokeTest.kt — read the source

SidecarPropertyRegistrationSmokeTest

object SidecarPropertyRegistrationSmokeTest

Characterization guard for the two-list contract behind sidecar files, and for the specific decision that remote_js is not a box property.

Declaration Summary
fun main(args: Array<String>)

SidecarReeditSmokeTest.kt

src/jvmMain/kotlin/afield/examples/SidecarReeditSmokeTest.kt — read the source

SidecarReeditSmokeTest

object SidecarReeditSmokeTest

Regression guard for a second external sidecar edit being lost.

Declaration Summary
fun main(args: Array<String>)

SimdVerletBulkKernelsExample.kt

src/jvmMain/kotlin/afield/examples/SimdVerletBulkKernelsExample.kt — read the source

SimdVerletBulkKernelsExample

object SimdVerletBulkKernelsExample

Worked examples of the generated bulk/SIMD vector kernels (afield.math.linalg.bulk.*) and their intended pairing with SimdVerlet.

Declaration Summary
fun main(args: Array<String>)

SimdVerletTinyExample.kt

src/jvmMain/kotlin/afield/examples/SimdVerletTinyExample.kt — read the source

SimdVerletTinyExample

object SimdVerletTinyExample

Tiny 3-particle Verlet example with 2 distance constraints and gravity.

Declaration Summary
fun main(args: Array<String>)

SortingNetworksSmokeTest.kt

src/jvmMain/kotlin/afield/examples/SortingNetworksSmokeTest.kt — read the source

SortingNetworksSmokeTest

object SortingNetworksSmokeTest

Smoke tests for SortingNetwork: build, notate, verify, visualise (FLine), and simulated-annealing optimisation.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

SpreadsheetFormulaSmoke.kt

src/jvmMain/kotlin/afield/examples/SpreadsheetFormulaSmoke.kt

TestDirectedConstraints4.kt

src/jvmMain/kotlin/afield/examples/TestDirectedConstraints4.kt — read the source

TestDirectedConstraints4

object TestDirectedConstraints4

Simple test to verify DirectedConstraints4 works correctly

Declaration Summary
fun main(args: Array<String>)

ThreeFeatureReviewWorkout.kt

src/jvmMain/kotlin/afield/examples/ThreeFeatureReviewWorkout.kt — read the source

ThreeFeatureReviewWorkout

object ThreeFeatureReviewWorkout

Trusted pointer input for the general geometry review browser regression.

Declaration Summary
fun checkGestures()

VisionGeometryPreviewGallery.kt

src/jvmMain/kotlin/afield/examples/VisionGeometryPreviewGallery.kt — read the source

VisionGeometryPreviewGallery

object VisionGeometryPreviewGallery

Headless geometry-preview gallery for the visionOS Live Metal head: takes a box's real geometry { … } program all the way to pixels on the Mac.

Declaration Summary
class Preview(val name: String, val title: String, val source: String, val frames: List<VisionGeometryPreview.FrameTick> = emptyList(), val camera: VisionGeometryPreview.Camera = VisionGeometryPreview.Camera(), val expectVertices: Int? = null, val expectTriangles: Int? = null, val expectDegenerate: Int = 0, val expectWinding: Double = 1.0, val restyle: (VisionGeometryPreview.Style) -> VisionGeometryPreview.Style = { it }, val check: (CapturedMesh) -> Unit = {}) One gallery entry: a Live Metal box source, how to drive it, and what must be true of it.
fun main(args: Array<String>)

VisionMetalKotlinJsExternalsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/VisionMetalKotlinJsExternalsSmokeTest.kt — read the source

VisionMetalKotlinJsExternalsSmokeTest

object VisionMetalKotlinJsExternalsSmokeTest

Compiles the typed surface and, when Node is present, links it against a faithful host shim.

Declaration Summary
fun main(args: Array<String>)

VisionPoseLatencySmokeTest.kt

src/jvmMain/kotlin/afield/examples/VisionPoseLatencySmokeTest.kt — read the source

VisionPoseLatencySmokeTest

object VisionPoseLatencySmokeTest

Guards the clock-offset arithmetic, which is the part of the latency measurement that cannot be checked by looking at it.

Declaration Summary
fun main(args: Array<String>)

VisionPoseStereoSourceSmokeTest.kt

src/jvmMain/kotlin/afield/examples/VisionPoseStereoSourceSmokeTest.kt — read the source

VisionPoseStereoSourceSmokeTest

object VisionPoseStereoSourceSmokeTest

Guards the step where a headset's pose becomes something Field can render from: VisionPoseStereoSource, the third pose source on SideBySideStereoTarget alongside OpenXR and the desktop mock.

Declaration Summary
fun main(args: Array<String>)

VisionPoseUplinkSmokeTest.kt

src/jvmMain/kotlin/afield/examples/VisionPoseUplinkSmokeTest.kt — read the source

VisionPoseUplinkSmokeTest

object VisionPoseUplinkSmokeTest

Guards the pose uplink's arithmetic, which is the half of the head-tracking milestone that a device cannot check for you.

Declaration Summary
fun main(args: Array<String>)

BoxAiToolsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ai/BoxAiToolsSmokeTest.kt — read the source

BoxAiToolsSmokeTest

object BoxAiToolsSmokeTest

Mechanism slice for box-authored AI tools (the aiTool DSL, DocumentToolRegistry, and the ToolExecutionContext.dynamicTools wiring into ToolRegistry).

Declaration Summary
fun main(args: Array<String>)

DocumentStudySmokeTest.kt

src/jvmMain/kotlin/afield/examples/ai/DocumentStudySmokeTest.kt — read the source

DocumentStudySmokeTest

object DocumentStudySmokeTest

A document defines a study as capable as a library one, from box code alone.

Declaration Summary
fun main(args: Array<String>)

RectslBoxToolsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/ai/RectslBoxToolsSmokeTest.kt — read the source

RectslBoxToolsSmokeTest

object RectslBoxToolsSmokeTest

Step-2 slice for box-authored AI tools: the RectSL studio tool set + the image-return and box-state-escape primitives. Drives the REAL box path — a box whose code declares a ki-var and calls registerRectslStudioTools() (unqualified, via the intro import) — then asserts, without a live model and without requiring a GPU: - rectsl.check compiles good source and reports diagnostics for bad source; - a {{ … }} escape compiled against the box's engine reads the box's live ki-var (the "escapes reference box state" requirement) — prewarmed off the runloop, then invoked; - the image-return primitive marshals correctly (base64 kept out of the JSON output); - rectsl.run fails gracefully (a structured tool error) when no renderer is in context — the GPU happy-path reuses the gallery-proven RectSLRenderRunner and runs in a live document.

Declaration Summary
fun main(args: Array<String>)

TrackingResonatorResynthesisExample.kt

src/jvmMain/kotlin/afield/examples/audio/TrackingResonatorResynthesisExample.kt — read the source

Top-level functions

Declaration Summary
fun main(args: Array<String>) Example:

BriefEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/brief/BriefEditorExtensionWorkout.kt — read the source

BriefEditorExtensionWorkout

object BriefEditorExtensionWorkout

Runs brief.js for real, in node, against a mocked Monaco.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

BriefSolveSmoke.kt

src/jvmMain/kotlin/afield/examples/brief/BriefSolveSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main() Brief, solved through the real Ceres backend, against answers worked out on paper.

CeresArchitecturalDslSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresArchitecturalDslSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresCanonicalVerification.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresCanonicalVerification.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresCrossThreadCloseSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresCrossThreadCloseSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main() A native session built on one thread and solved and closed on another.

CeresExpressionCost.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresExpressionCost.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresExpressionSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresExpressionSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresExpressionVariablesSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresExpressionVariablesSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresGeometryPrimitivesSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresGeometryPrimitivesSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresInteractionExamples.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresInteractionExamples.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresPlaneFormulationStudy.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresPlaneFormulationStudy.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresPolytopeRealizerComparison.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresPolytopeRealizerComparison.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresRealizerCacheCost.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresRealizerCacheCost.kt — read the source

Top-level functions

Declaration Summary
fun main()

CeresRealizerDiagnostic.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresRealizerDiagnostic.kt — read the source

Top-level functions

Declaration Summary
fun main() What the Ceres problem actually looks like for each solid, as Ceres itself reports it.

CeresSolverOptionsSmoke.kt

src/jvmMain/kotlin/afield/examples/ceres/CeresSolverOptionsSmoke.kt — read the source

Top-level functions

Declaration Summary
fun main() Exercises the solver options, the summary, the selectable loss and the midsphere constraint family, against a problem with a known closed-form answer.

PhotoToSolidChain.kt

src/jvmMain/kotlin/afield/examples/chain/PhotoToSolidChain.kt — read the source

PhotoToSolidChain

object PhotoToSolidChain

A photograph becomes a printable solid, and every hop owes the next one a number.

Declaration Summary
const val PHOTO A real photograph that already ships in the repository: a Vision Pro passthrough frame.
fun toRgba8(img: Img): ByteBuffer Both ONNX models want tightly packed RGBA8 and an Img is interleaved floats — this is the whole adapter, and it is the same one onnx.md shows. Nothing in afield.ai.inference.onnx knows Img.
fun depthMapOf(photo: Img, longestSide: Int = 266, blurSigma: Double = 1.2): Pair<Img, DepthAnything> The depth map, as a single-channel Img in [0, 1] with near = high.
fun frameAround(footprintX: Double, footprintZ: Double, overlap: Double = 0.08): Solid A picture frame: a slab with a rectangular window, which is a torus and therefore genus 1.
data class Mounted(val relief: TriMesh, val frame: TriMesh, val footprintZ: Double, val volume: Double, val plaqueVolume: Double, val genus: Int, val parts: Int, val depth: Img) The whole route in one value: the photograph's relief and the frame it is mounted in, as two disjoint meshes plus the numbers the hops owed each other.
fun mount(grid: Int = 176, longestSide: Int = 266, blurSigma: Double = 0.7): Mounted Mounted for the photograph that ships with Field. See PHOTO.
fun marchedPlaque(depth: Img, footprintZ: Double, edgeLength: Double, floor: Double = -BASE): Solid The same plaque as Img.toReliefMesh builds, but marched out of a field instead — the independent second construction the volume agreement is checked against.
fun main(args: Array<String>)

DatalogEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/datalog/DatalogEditorExtensionWorkout.kt — read the source

DatalogEditorExtensionWorkout

object DatalogEditorExtensionWorkout

Runs datalog.js for real, under node, against a mock Monaco.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

FaustBoxExamples.kt

src/jvmMain/kotlin/afield/examples/faust/FaustBoxExamples.kt

FaustEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/faust/FaustEditorExtensionWorkout.kt — read the source

FaustEditorExtensionWorkout

object FaustEditorExtensionWorkout

Runs the shipped faust.js under node against the shipped vocabulary.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

ForthInterpreterSmokeTest.kt

src/jvmMain/kotlin/afield/examples/forth/ForthInterpreterSmokeTest.kt — read the source

ForthInterpreterSmokeTest

object ForthInterpreterSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

AlifeShaderSystemsSmoke.kt

src/jvmMain/kotlin/afield/examples/four/AlifeShaderSystemsSmoke.kt — read the source

AlifeShaderSystemsSmoke

object AlifeShaderSystemsSmoke

Runs ShaderLatticeBoltzmannSystem and ShaderForestFireSystem on a real renderer and reads their textures back, the way the lattice_boltzmann_cylinder and forest_fire starting points drive them: a module built on the system's own controlsParameters / fireInputParameters, added with addControls / addFireInput, drawn by a fullscreenTriangle.

Declaration Summary
fun main(args: Array<String>)

BoidSketchSmoke.kt

src/jvmMain/kotlin/afield/examples/four/BoidSketchSmoke.kt — read the source

BoidSketchSmoke

object BoidSketchSmoke

That a BoidSketch step on the GPU is the boids page's stepWorld, per boid.

Declaration Summary
fun main(args: Array<String>)

DualQuaternionfSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/DualQuaternionfSmokeTest.kt — read the source

DualQuaternionfSmokeTest

object DualQuaternionfSmokeTest

Declaration Summary
fun main(args: Array<String>)

FabricatePassChainDemo.kt

src/jvmMain/kotlin/afield/examples/four/FabricatePassChainDemo.kt — read the source

FabricatePassChainDemo

object FabricatePassChainDemo

Holds the heterogeneous pass chain to the pixels, and is the thing to run to see it.

Declaration Summary
fun main(args: Array<String>)

FabricateQuadtreeChainDemo.kt

src/jvmMain/kotlin/afield/examples/four/FabricateQuadtreeChainDemo.kt — read the source

FabricateQuadtreeChainDemo

object FabricateQuadtreeChainDemo

Holds the two summarised-quadtree templates to arithmetic: a 2×2 reduction pyramid over a raster, and a Morton-code/sort/prefix-range quadtree over a point set.

Declaration Summary
fun main(args: Array<String>)

FabricateReprojectionDemo.kt

src/jvmMain/kotlin/afield/examples/four/FabricateReprojectionDemo.kt — read the source

FabricateReprojectionDemo

object FabricateReprojectionDemo

Holds frame-history reprojection to the pixels.

Declaration Summary
fun main(args: Array<String>)

FabricateSimulationChainDemo.kt

src/jvmMain/kotlin/afield/examples/four/FabricateSimulationChainDemo.kt — read the source

FabricateSimulationChainDemo

object FabricateSimulationChainDemo

Holds the two simulation templates to the pixels: a Stam stable fluid and a jump flood distance transform, both declared as FabricatePassChains.

Declaration Summary
fun main(args: Array<String>)

FieldProbeSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/FieldProbeSmokeTest.kt — read the source

FieldProbeSmokeTest

class FieldProbeSmokeTest

FieldStatsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/FieldStatsSmokeTest.kt — read the source

FieldStatsSmokeTest

class FieldStatsSmokeTest

GpuNeighbourGridSmoke.kt

src/jvmMain/kotlin/afield/examples/four/GpuNeighbourGridSmoke.kt — read the source

GpuNeighbourGridSmoke

object GpuNeighbourGridSmoke

That GpuNeighbourGrid finds exactly the right neighbours — as sets, against brute force.

Declaration Summary
fun main(args: Array<String>)

GpuPressureProjectionProbe.kt

src/jvmMain/kotlin/afield/examples/four/GpuPressureProjectionProbe.kt — read the source

GpuPressureProjectionProbe

object GpuPressureProjectionProbe

That a chain of compute dispatches — divergence, then Jacobi pressure, then project — leaves a velocity field that is measurably divergence-free, and that it gets more so with iterations.

Declaration Summary
fun main(args: Array<String>)

GpuProbeSelfCheck.kt

src/jvmMain/kotlin/afield/examples/four/GpuProbeSelfCheck.kt — read the source

GpuProbeSelfCheck

object GpuProbeSelfCheck

That GpuProbe's own guarantees actually fire — a negative control for the harness.

Declaration Summary
fun main(args: Array<String>)

GpuSchemaExample.kt

src/jvmMain/kotlin/afield/examples/four/GpuSchemaExample.kt — read the source

Top-level functions

Declaration Summary
fun gpuSchemaExampleGlsl(): String GLSL declaration text suitable for a quick compiler/debug inspection.

Top-level values

Declaration Summary
val PARTICLE_SCHEMA

SchemaExampleParticle

data class SchemaExampleParticle(val position: Vector3f, val radius: Float, val color: Vector4f, val flags: UInt)

Smallest non-renderer example of the structured-memory ABI.

Declaration Summary
val position: Vector3f
val radius: Float
val color: Vector4f
val flags: UInt

GpuSchemaSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/GpuSchemaSmokeTest.kt — read the source

GpuSchemaSmokeTest

object GpuSchemaSmokeTest

Verifies nested CPU packing and array stride through real buffer-address GPU loads.

Declaration Summary
data class Material(val color: Vector4f, val roughness: Float, val metallic: Float)
data class Particle(val position: Vector3f, val radius: Float, val material: Material, val flags: UInt)
fun main(args: Array<String>)

GpuSkinningSmoke.kt

src/jvmMain/kotlin/afield/examples/four/GpuSkinningSmoke.kt — read the source

GpuSkinningSmoke

object GpuSkinningSmoke

That the GPU puts every skinned vertex exactly where GltfSkinning.skin says it goes.

Declaration Summary
fun main(args: Array<String>)
fun placement(i: Int): Matrix4f Instance i placed on a grid, so a rendered crowd is a crowd and not one character.

ImGuiRTTExample.kt

src/jvmMain/kotlin/afield/examples/four/ImGuiRTTExample.kt — read the source

ImGuiRTTExample

object ImGuiRTTExample

Backwards-compatible shim for the old example helper.

Declaration Summary
fun get(renderer: Renderer = fromContext(), window: Window = renderer.window, name: String = "imgui-rtt", overSample: Int = 2, fontSuperSample: Float = 4f, target: RenderTarget = renderer.renderList): ImGuiRenderToTexture Returns an ImGuiRenderToTexture configured through the old example helper API.
operator fun invoke(renderer: Renderer = fromContext(), window: Window = renderer.window, name: String = "imgui-rtt", overSample: Int = 2, fontSuperSample: Float = 4f, target: RenderTarget = renderer.renderList): ImGuiRenderToTexture

ImGuiStereoQuadExample.kt

src/jvmMain/kotlin/afield/examples/four/ImGuiStereoQuadExample.kt — read the source

ImGuiStereoQuadExample

class ImGuiStereoQuadExample(val window: Window = fromContext(), val renderer: Renderer = fromContext(), val sbs: SideBySideStereoTarget = fromContext())

Declaration Summary
val window: Window
val renderer: Renderer
val sbs: SideBySideStereoTarget
var lastHitWorld: Vector3f?
fun go()

ImGuiVrPanelDemo.kt

src/jvmMain/kotlin/afield/examples/four/ImGuiVrPanelDemo.kt — read the source

ImGuiVrPanelDemo

class ImGuiVrPanelDemo(val window: Window, val renderer: Renderer, val sbs: SideBySideStereoTarget)

Standalone, runnable end-to-end demo of "ImGui as an in-VR panel".

Declaration Summary
val window: Window
val renderer: Renderer
val sbs: SideBySideStereoTarget
var hitU
var hitV
var hitActive
var lastHitWorld: Vector3f?
fun build()
fun aimControllerAtPanelCentre() Aim the mock controller straight at the panel centre (for headless/deterministic runs).
fun cleanup() Release ImGui/Vulkan resources owned by the demo (caller still cleans renderer + window).
fun runInteractive() Interactive desktop loop: mouse drives the mock controller ray.
fun runCapture(outputPath: String) Verification loop: aim the mock controller straight at the panel centre, render a warm-up of frames, then grab the live macOS window with screencapture (the same tool doc.kt uses for Field 4 window shots). We deliberately avoid the Vulkan swapchain readback here because that path is Y-flipped for our blitted content; screencapture records exactly what is on screen.
fun runCaptureGpu(outputPath: String) Headless verification capture: aim at the panel centre, render a warm-up of frames, then read the swapchain back to a PNG with Renderer.captureWindowToFile (a Vulkan transfer-source copy — unlike screencapture it needs no Screen-Recording permission and works over SSH/CI). The captured pixels are the blitted side-by-side packed image, preserving the orientation presented by the swapchain.
var running

ImGuiVrPanelSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/ImGuiVrPanelSmokeTest.kt — read the source

ImGuiVrPanelSmokeTest

class ImGuiVrPanelSmokeTest

End-to-end smoke for the ImGui-as-a-VR-panel pipeline: builds the ImGui -> RTT -> stereo-quad -> side-by-side pipeline exactly as ImGuiVrPanelDemo, renders a warm-up of frames on a real Vulkan window with the mock controller aimed at the panel centre, and asserts the controller ray -> quad hit-test round-trips to panel-centre UV.

ImageReducerExample.kt

src/jvmMain/kotlin/afield/examples/four/ImageReducerExample.kt — read the source

ImageReducerExample

class ImageReducerExample

Example demonstrating the usage of ImageReducer utility class.

Declaration Summary
val window
val renderer
fun runOnce() Example 1: "Just do it once" - synchronous one-shot execution
fun runPerFrame() Example 2: "Do it every frame" - install into RenderTarget.others

KeyframeSweepDemo.kt

src/jvmMain/kotlin/afield/examples/four/KeyframeSweepDemo.kt — read the source

KeyframeSweepDemo

object KeyframeSweepDemo

Drives KeyframeSweep against a real GPU render, and is the thing to run to watch an overnight sweep work.

Declaration Summary
class Rig(val bundle: StandardRenderer.Bundle, val scope: KeyframeScope, val cameraAt: Vector3f) A scene plus the keyframe scope that watches it — everything a sweep needs except the pool.
fun buildRig(renderer: Renderer): Rig Build the scene and register every lane of it that a key can drive.
fun writePool(scope: KeyframeScope, dir: Path): Int Write a small pool of hand-authored keys into dir, as a person would have arrived at them, and answer how many.
suspend fun sweep(rig: Rig, renderer: Renderer, pool: Path, out: Path, config: SweepConfig, advance: suspend (Int) -> Unit): SweepReport Run a sweep over rig, writing a still and a short clip per render.
fun main(args: Array<String>)

LiveFrameBufferLifetimeSmoke.kt

src/jvmMain/kotlin/afield/examples/four/LiveFrameBufferLifetimeSmoke.kt — read the source

LiveFrameBufferLifetimeSmoke

object LiveFrameBufferLifetimeSmoke

The three lifetimes behind the live-frame crash in dev_docs/renderer_teardown_order.md ("Live-frame crash"), checked on a real device without depending on a driver to fault.

Declaration Summary
fun main(args: Array<String>)

LiveProfilingSwitchSmoke.kt

src/jvmMain/kotlin/afield/examples/four/LiveProfilingSwitchSmoke.kt — read the source

LiveProfilingSwitchSmoke

object LiveProfilingSwitchSmoke

Options.profiling switched on and off on a running renderer: the GPU queries follow it, no restart.

Declaration Summary
fun main(args: Array<String>)

NanoOutputBoundsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/NanoOutputBoundsSmokeTest.kt — read the source

NanoOutputBoundsSmokeTest

object NanoOutputBoundsSmokeTest

Runs the production shader on adjacent byte slices, including shared packed words.

Declaration Summary
fun main(args: Array<String>)

NeuralFieldParitySmoke.kt

src/jvmMain/kotlin/afield/examples/four/NeuralFieldParitySmoke.kt — read the source

NeuralFieldParitySmoke

object NeuralFieldParitySmoke

Step one of the neural-particle pilot: that a network trained on the CPU is the same network when a compute shader evaluates it.

Declaration Summary
fun main(args: Array<String>)

NeuralParticlesSmoke.kt

src/jvmMain/kotlin/afield/examples/four/NeuralParticlesSmoke.kt — read the source

NeuralParticlesSmoke

object NeuralParticlesSmoke

Step two of the neural-particle pilot: that a buffer of particles integrated on the GPU along a trained field goes where the CPU says it should.

Declaration Summary
fun main(args: Array<String>)

NewMain6.kt

src/jvmMain/kotlin/afield/examples/four/NewMain6.kt — read the source

NewMain6

class NewMain6

Declaration Summary
val window
val renderer
var angle
fun update()
fun cleanup()
var running
fun run()

NewMain7_dynamicNumberOfVerts.kt

src/jvmMain/kotlin/afield/examples/four/NewMain7_dynamicNumberOfVerts.kt — read the source

NewMain7_dynamicNumberOfVerts

class NewMain7_dynamicNumberOfVerts

Declaration Summary
val window
val renderer
var angle
fun update()
fun cleanup()
var running
fun run()

NewMain7_errorChecking.kt

src/jvmMain/kotlin/afield/examples/four/NewMain7_errorChecking.kt — read the source

NewMain7_errorChecking

class NewMain7_errorChecking

Declaration Summary
val window
val renderer
var angle
fun update()
fun cleanup()
var running
fun run()

NewMain8_writeToImage.kt

src/jvmMain/kotlin/afield/examples/four/NewMain8_writeToImage.kt — read the source

NewMain8_writeToImage

class NewMain8_writeToImage

Declaration Summary
val window
val renderer
var angle
fun update()
fun cleanup()
var running
fun run()

OpenDlssNrLiveEditSmoke.kt

src/jvmMain/kotlin/afield/examples/four/OpenDlssNrLiveEditSmoke.kt — read the source

OpenDlssNrLiveEditSmoke

object OpenDlssNrLiveEditSmoke

Live edits that used to need a box rerun. OpenDlssNrStudy.reload with a new varying between the stages rebuilds the source and the next frames draw with it; with the native library present, a pass added to a Fabricate post stack leaves that stack when it closes. Without the library the reload half still runs, in source mode.

Declaration Summary
fun main(args: Array<String>)

OpenDlssNrTeardownSmoke.kt

src/jvmMain/kotlin/afield/examples/four/OpenDlssNrTeardownSmoke.kt — read the source

OpenDlssNrTeardownSmoke

object OpenDlssNrTeardownSmoke

The renderer goes away while an OpenDlssNrStudy is still open on it, which is what quitting or disposing the graphics context does to a box that was never stopped. The study is closed by the renderer, before its device, and the box's own later close is harmless. Without the native library the study runs in source mode, so this needs a GPU but not NVIDIA.

Declaration Summary
fun main(args: Array<String>)

ParticleSketchSmoke.kt

src/jvmMain/kotlin/afield/examples/four/ParticleSketchSmoke.kt — read the source

ParticleSketchSmoke

object ParticleSketchSmoke

That a ParticleSketch step on the GPU does what madp's JavaScript does, per particle.

Declaration Summary
fun main(args: Array<String>)

PhysarumGpuSmoke.kt

src/jvmMain/kotlin/afield/examples/four/PhysarumGpuSmoke.kt — read the source

PhysarumGpuSmoke

object PhysarumGpuSmoke

Runs ShaderPhysarumSystem (a million agents on a 1024x1024 TrailField) on a real renderer and reads its trail back as floats, so the GPU network is measured the way alife_examples.md §7 measures the CPU one: topShare(0.05) of the sensing population against the same population turning at random. Also checks TrailField on its own: a held channel keeps a deposit, a decaying one halves in its half-life, and clear() empties it.

Declaration Summary
fun main(args: Array<String>)

PingPongRestoreSmoke.kt

src/jvmMain/kotlin/afield/examples/four/PingPongRestoreSmoke.kt — read the source

PingPongRestoreSmoke

object PingPongRestoreSmoke

Real transfers through every slot of ordinary and cadenced, two-attachment, two-layer rings.

Declaration Summary
fun main(args: Array<String>)

PlyLoaderTest.kt

src/jvmMain/kotlin/afield/examples/four/PlyLoaderTest.kt — read the source

Top-level functions

Declaration Summary
fun main() Simple test program to verify PLY loader functionality without requiring full graphics setup

RendererCleanupSmoke.kt

src/jvmMain/kotlin/afield/examples/four/RendererCleanupSmoke.kt — read the source

RendererCleanupSmoke

object RendererCleanupSmoke

Close immediately after buffer replacement, before deferred releases can age out.

Declaration Summary
fun main(args: Array<String>)

ShaderBoidsSmoke.kt

src/jvmMain/kotlin/afield/examples/four/ShaderBoidsSmoke.kt — read the source

ShaderBoidsSmoke

object ShaderBoidsSmoke

That GPU boids computes the same force as a CPU brute force over the same law, per particle.

Declaration Summary
fun main(args: Array<String>)

ShaderCopyPushConstantTemplateSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/ShaderCopyPushConstantTemplateSmokeTest.kt — read the source

ShaderCopyPushConstantTemplateSmokeTest

class ShaderCopyPushConstantTemplateSmokeTest

ShaderFieldAutoControlSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/ShaderFieldAutoControlSmokeTest.kt — read the source

ShaderFieldAutoControlSmokeTest

class ShaderFieldAutoControlSmokeTest

ShaderFieldQuantileWarpSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/ShaderFieldQuantileWarpSmokeTest.kt — read the source

ShaderFieldQuantileWarpSmokeTest

class ShaderFieldQuantileWarpSmokeTest

ShaderReloadTransactionSmoke.kt

src/jvmMain/kotlin/afield/examples/four/ShaderReloadTransactionSmoke.kt — read the source

ShaderReloadTransactionSmoke

object ShaderReloadTransactionSmoke

A full shader reload (reloadShader, the Reload Shader action) is a transaction: the new module is built first, and only a module that actually went live rewrites the box's preamble and retires the one it replaced.

Declaration Summary
fun main(args: Array<String>)

ShaderReloadTransitionSmoke.kt

src/jvmMain/kotlin/afield/examples/four/ShaderReloadTransitionSmoke.kt — read the source

ShaderReloadTransitionSmoke

object ShaderReloadTransitionSmoke

The reload-transition matrix, on a real device: one box, one graphics module, and a full reload (reloadShader) per row, with frames rendered between them so buffers are written and retirements go through the renderer's deferred queue. Each row checks what the module holds afterwards, what the preamble says, which buffers and values were carried, and what the person was told.

Declaration Summary
fun main(args: Array<String>)

ShaderTypedStructurePreambleSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/ShaderTypedStructurePreambleSmokeTest.kt — read the source

ShaderTypedStructurePreambleSmokeTest

class ShaderTypedStructurePreambleSmokeTest

SlugRenderSmoke.kt

src/jvmMain/kotlin/afield/examples/four/SlugRenderSmoke.kt — read the source

SlugRenderSmoke

object SlugRenderSmoke

Real analytic coverage, alpha and immutable atlas replacement on the GPU.

Declaration Summary
fun main(args: Array<String>)

StereoPackingSmokeTest.kt

src/jvmMain/kotlin/afield/examples/four/StereoPackingSmokeTest.kt — read the source

StereoPackingSmokeTest

object StereoPackingSmokeTest

Checks the first packed-image sampling, eye draw count, and eye aspect on a non-square window.

Declaration Summary
fun main(args: Array<String>)

EvolveWorkedExample.kt

src/jvmMain/kotlin/afield/examples/functions/EvolveWorkedExample.kt — read the source

EvolveWorkedExample

object EvolveWorkedExample

The CPU-only reproducibility floor behind the evolve walkthrough in public/docs/functions_examples.md.

Declaration Summary
const val RNG_SEED: Long Fixed so the whole run is reproducible.
const val ITERATIONS: Int
const val LAMBDA: Int
const val SAMPLES: Int
const val VARIETY_COUNT: Int
const val VARIETY_ITERATIONS: Int
const val VARIETY_RNG_SEED: Long
const val VARIETY_NEIGHBOURS: Int
const val VARIETY_SAMPLES: Int
data class Result(val run: FnEvolveRun, val variety: FnVarietyRun)
fun runExample(): Result Run the worked example on the CPU and return the raw evolve / variety objects. Pure computation: no rendering, no file output. Given the fixed seeds it returns the same numbers and graphs every time — that reproducibility is the whole point.
fun main(args: Array<String>)

FnRewriteKotlinLiveBoxProbe.kt

src/jvmMain/kotlin/afield/examples/functions/FnRewriteKotlinLiveBoxProbe.kt — read the source

FnRewriteKotlinLiveBoxProbe

object FnRewriteKotlinLiveBoxProbe

Runs one rewriteKotlin spec inside a live box, headlessly, in seconds.

Declaration Summary
fun verifiedNegativeCache() Called only after the live compiler rejection, repair and invalidation assertions pass.
fun tick() Called by the box body, once per entry.
fun main(args: Array<String>)
fun run(mode: String) The two modes share this whole harness, and the only difference between them is which box's engine the @{...} snippet is compiled in. Mode is a parameter and not an environment variable because run_field_tests.py drives the entrypoint through a Field server it starts itself, so the caller's environment never reaches this JVM.

FnRewriteKotlinTwoBoxProbe

object FnRewriteKotlinTwoBoxProbe

The same spec as FnRewriteKotlinLiveBoxProbe, compiled in a second, idle box instead of the running one — the positive control, and the pair that makes the one-box failure mean something.

Declaration Summary
fun main(args: Array<String>)

FnRewriteKotlinFailureCacheProbe

object FnRewriteKotlinFailureCacheProbe

Verify negative caching and explicit recovery against a real idle box's Kotlin compiler.

Declaration Summary
fun main(args: Array<String>)

SourceBackedBlockSelfBoxProbe

object SourceBackedBlockSelfBoxProbe

afield.study.source.SourceBackedBlock's own route into the self-box trap, measured rather than inferred.

Declaration Summary
fun main(args: Array<String>)

SourceBackedBlockTwoBoxProbe

object SourceBackedBlockTwoBoxProbe

The same block hydrated in an idle parent box — the positive control for the one above.

Declaration Summary
fun main(args: Array<String>)

FunctionsPlotGallery.kt

src/jvmMain/kotlin/afield/examples/functions/FunctionsPlotGallery.kt — read the source

FunctionsPlotGallery

object FunctionsPlotGallery

Headless plot-capture harness for the afield.math.functions.Functions library — the honest vehicle RectSL/StackSL already had and Functions lacked. It renders Functions.Fn results (differentiable-fit before→after, waveshaper transfer curves, waveshaping on a sine, and a composed pipeline) to REAL raster PNGs.

Declaration Summary
enum class Style How a series is drawn.
class Series(val label: String, val xs: DoubleArray, val ys: DoubleArray, val color: Color, val style: Style = Style.LINE) One plotted curve: its label, sampled (xs, ys), color and draw style.
class PlotSpec(val title: String, val xLabel: String, val yLabel: String, val series: List<Series>, val yRange: Pair<Double, Double>? = null) A single figure: title, axis labels, series and optional fixed yRange.
class Plot(val name: String, val build: Functions.() -> PlotSpec) A named plot the gallery renders. build runs inside the Functions receiver.
val PLOTS: List<Plot>
fun render(spec: PlotSpec): BufferedImage
fun main(args: Array<String>)
fun renderFitConvergenceMp4(outDir: File): File? Render functions-fit-convergence.mp4: the fitted curve landing on the target over the descent. Returns the mp4, or null if ffmpeg is unavailable.

WaveshapeWorkedExample.kt

src/jvmMain/kotlin/afield/examples/functions/WaveshapeWorkedExample.kt — read the source

WaveshapeWorkedExample

object WaveshapeWorkedExample

A CPU-only reproducibility check for the waveshaping / distortion transform family (fold / rectify / quantize / crush / chebyshev / clip / softClip / clamp / wrapY).

Declaration Summary
const val SAMPLES: Int
data class Cell(val label: String, val fn: Functions.Fn, val domain: Functions.Domain, val xs: DoubleArray, val ys: DoubleArray) One transfer-curve cell: the transform's label, the graph fn, and the sampled (xs, ys) of that fn across domain.
data class Result(val cells: List<Cell>)
fun runExample(samples: Int = SAMPLES): Result Build the sweep, push it through every shaper, and sample each transfer curve. Pure and deterministic — no I/O — so two calls return identical numbers.
fun main(args: Array<String>)

FLineGeometryExamples.kt

src/jvmMain/kotlin/afield/examples/graphics/FLineGeometryExamples.kt — read the source

FLineGeometryExamples

object FLineGeometryExamples

Example demonstrations of FLineGeometry utilities. These examples show practical usage of various computational geometry functions.

Declaration Summary
fun spiralCurvatureExample(): Map<String, List<FLine>> Example 1: Create a spiral and analyze its curvature
fun offsetShapeExample(): Map<String, List<FLine>> Example 2: Create a shape and generate offset versions
fun booleanOperationsExample(): Map<String, List<FLine>> Example 3: Boolean operations on shapes
fun smoothAndSimplifyExample(): Map<String, List<FLine>> Example 4: Smooth and simplify a noisy path
fun tangentNormalExample(): Map<String, List<FLine>> Example 5: Generate tangent and normal vectors
fun morphingExample(steps: Int = 5): Map<String, List<FLine>> Example 6: Morphing between two shapes
fun patternExample(): Map<String, List<FLine>> Example 7: Pattern generation (wave, dash, zigzag)
fun transformations3DExample(): Map<String, List<FLine>> Example 8: 3D transformations and projections
fun convexHullExample(): Map<String, List<FLine>> Example 9: Convex hull computation
fun adaptiveSamplingExample(): Map<String, List<FLine>> Example 10: Curvature-adaptive sampling
fun comprehensiveDemo(): Map<String, List<FLine>> Comprehensive demo that exercises most functionality
fun arcExample(): Map<String, List<FLine>> Example 11: Arc construction and higher-order curves
fun noiseComparisonExample(): Map<String, List<FLine>> Example 12: Noise utilities comparison
fun curveCombinationExample(): Map<String, List<FLine>> Example 13: Curve combination operations
fun parameterizationExample(): Map<String, List<FLine>> Example 14: Parameterization system
fun complexCompositionExample(): Map<String, List<FLine>> Example 15: Complex composition with new features
fun transformations2DExample(): Map<String, List<FLine>> Example 16: 2D transformations around explicit pivots and axes
fun parallelCurvesExample(): Map<String, List<FLine>> Example 17: Parallel curve generation
fun intersectionsExample(): Map<String, List<FLine>> Example 18: Intersections and self-intersections
fun curvatureFeaturesExample(): Map<String, List<FLine>> Example 19: Curvature features and inflections
fun osculatingCirclesExample(): Map<String, List<FLine>> Example 20: Osculating circles along a curve
fun geometricQueriesExample(): Map<String, List<FLine>> Example 21: Geometric queries and point tests
fun pathOperationsExample(): Map<String, List<FLine>> Example 22: Path operations (reverse, concatenate, extract)
fun curveFittingExample(): Map<String, List<FLine>> Example 23: Comprehensive curve and line fitting operations
fun higherOrderCurvesExample(): Map<String, List<FLine>> Example 24: Higher-order curves (quadratic, tangential arc, B-spline)
fun eulerSpiralExample(): Map<String, List<FLine>> Example 25: Euler spiral interpolation
fun curvatureFlowExample(): Map<String, List<FLine>> Example 26: Curvature-driven evolution (flow)
fun gaussianProcessExample(): Map<String, List<FLine>> Example 27: Gaussian Process interpolation
fun smileSplineExample(): Map<String, List<FLine>> Example 28: Smile cubic spline interpolation.
fun smileGaussianProcessExample(): Map<String, List<FLine>> Example 29: Smile Gaussian Process interpolation.
fun akimaInterpolationExample(): Map<String, List<FLine>> Example 30: Custom Akima interpolation.
fun filteringExample(): Map<String, List<FLine>> Example 31: Filtering comparisons
fun comprehensiveSmokeTest(): Boolean Comprehensive smoke test that exercises all examples and every function in FLineGeometry at least once to check for sanity and exceptions.

FLineHitInspectorFigure.kt

src/jvmMain/kotlin/afield/examples/graphics/FLineHitInspectorFigure.kt — read the source

FLineHitInspectorFigure

object FLineHitInspectorFigure

The figure behind the hit-record work, as a file you can open in a browser.

Declaration Summary
const val WIDTH: Double How wide and tall the figure is drawn, in the figure's own units.
const val HEIGHT: Double
fun onWall(u: Double, v: Double): Vec3 A point on the wall: u runs along it (0 at the near end, 1 at the far end), v up it.
fun panelWall(): List<FLine> One FLine per panel, plus the ridge line along the top of the wall.
fun svg(onHit: (afield.graphics.render.FLineIntersection) -> Unit = {}): String The interactive SVG for panelWall, with a click callback on every line.
fun main(args: Array<String>)

FLineInstructionTrajectoryTrackerSmokeTest.kt

src/jvmMain/kotlin/afield/examples/graphics/FLineInstructionTrajectoryTrackerSmokeTest.kt — read the source

FLineInstructionTrajectoryTrackerSmokeTest

object FLineInstructionTrajectoryTrackerSmokeTest

Lightweight smoke tests for FLineInstructionTrajectoryTracker.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

FLineSerializationSmokeTest.kt

src/jvmMain/kotlin/afield/examples/graphics/FLineSerializationSmokeTest.kt — read the source

FLineSerializationSmokeTest

object FLineSerializationSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

PolynomialTreeFittingSmokeTest.kt

src/jvmMain/kotlin/afield/examples/graphics/PolynomialTreeFittingSmokeTest.kt — read the source

PolynomialTreeFittingSmokeTest

object PolynomialTreeFittingSmokeTest

Smoke tests for polynomial-tree fitting + leaf rendering styles.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)
fun figureEightRibbonPoints(count: Int): List<Vec3>

ImagingGallery.kt

src/jvmMain/kotlin/afield/examples/imaging/ImagingGallery.kt — read the source

ImagingGallery

object ImagingGallery

Headless capture gallery for the afield.media.image imaging / computer-vision family — the honest visual proof that the pixels come out right, in the pattern afield.examples.functions.FunctionsPlotGallery and afield.examples.rectsl.RectSLDataVizProof established.

Declaration Summary
class Panel(val name: String, val title: String, val build: () -> Figure) One gallery figure: a name (its PNG filename), a title, a list of captioned image tiles, optional vector overlays drawn on top of a named tile, and a check that must pass for the run to succeed.
class Tile(val caption: String, val img: Img, val overlays: List<Overlay> = emptyList(), val zoom: Int = 1) A captioned raster tile.
class Overlay(val lines: List<FLine>, val color: Color, val width: Float = 1.4f, val dots: Boolean = false) Vector geometry drawn over a tile, in that tile's image coordinates.
class Figure(val tiles: List<Tile>, val summary: String) A built figure: the tiles to lay out plus a one-line factual summary printed to stdout.
val PANELS: List<Panel>
fun main(args: Array<String>)

PolytopeLayerContours.kt

src/jvmMain/kotlin/afield/examples/manifold/PolytopeLayerContours.kt — read the source

PolytopeLayerContours

object PolytopeLayerContours

Does canonicalising a Conway polytope change its printable layer contours, and by how much?

Declaration Summary
data class Layer(val z: Double, val contours: Int, val holes: Int, val islands: Int, val area: Double) One horizontal cut, reduced to the four numbers a slicer cares about.
fun main(args: Array<String>)

MeshGallery.kt

src/jvmMain/kotlin/afield/examples/mesh/MeshGallery.kt — read the source

MeshGallery

object MeshGallery

Headless capture gallery for the afield.geometry.mesh triangle-mesh family — the honest visual proof that the geometry comes out right, in the pattern afield.examples.imaging.ImagingGallery and afield.examples.VisionGeometryPreviewGallery established.

Declaration Summary
class Cell(val caption: String, val mesh: TriMesh, val view: MeshView = MeshView(width = CELL_W, height = CELL_H), val facts: String? = null, val image: BufferedImage? = null) One rendered cell: a mesh, how to look at it, and the caption printed under it.
class Figure(val cells: List<Cell>, val summary: String, val columns: Int = 4, val factLines: Int = 1) A built figure: the cells to lay out, plus the one-line factual summary printed to stdout.
class Panel(val name: String, val title: String, val subtitle: String, val build: () -> Figure) One gallery figure: a name (its PNG filename), a title, a builder, and its invariants.
fun main(args: Array<String>)

WebcamPerceptionDemo.kt

src/jvmMain/kotlin/afield/examples/onnx/WebcamPerceptionDemo.kt — read the source

WebcamPerceptionDemo

object WebcamPerceptionDemo

Depth and CLIP, on real webcam frames.

Declaration Summary
fun main(args: Array<String>)

PetriEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/petri/PetriEditorExtensionWorkout.kt — read the source

PetriEditorExtensionWorkout

object PetriEditorExtensionWorkout

Runs petri.js for real, under node, against a mock Monaco.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

PetriGallery.kt

src/jvmMain/kotlin/afield/examples/petri/PetriGallery.kt — read the source

PetriGallery

object PetriGallery

The worked #petri programs behind the documentation, run for real, plus the guard that keeps the cheatsheet honest.

Declaration Summary
fun main(args: Array<String>)
fun nets(): List<Pair<String, PetriNet>> Every net the gallery builds, by name — the notation programs and the Kotlin-DSL ones.
fun runTests(outputDir: File? = null): Boolean

PetriTalaComparison.kt

src/jvmMain/kotlin/afield/examples/petri/PetriTalaComparison.kt — read the source

PetriTalaComparison

object PetriTalaComparison

Draws one net twice — PetriLayout.FORCE and PetriLayout.TALA — side by side, and writes the result to build/petri-tala/comparison.html.

Declaration Summary
fun main(args: Array<String>)

playlist_example.kt

src/jvmMain/kotlin/afield/examples/playlist_example.kt

RectSLDataVizProof.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLDataVizProof.kt — read the source

RectSLDataVizProof

object RectSLDataVizProof

Pixel proof for the RectSL data-visualization family. Two kinds of PNG:

Declaration Summary
val PLOT_SOURCE: String The plotting-layer demo (kept identical to the transcript rectsl_plot_axes.yaml).
val DEMO_SOURCE: String The loadable-demo program (kept identical to dev_docs/agents/transcripts/rectsl_dataviz.yaml).
fun main(args: Array<String>)

RectSLDocumentToolSmoke.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLDocumentToolSmoke.kt

RectSLEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLEditorExtensionWorkout.kt — read the source

RectSLEditorExtensionWorkout

object RectSLEditorExtensionWorkout

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

RectSLExamples.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLExamples.kt — read the source

RectSLExamples

object RectSLExamples

Declaration Summary
val minimalMirror: String
val layeredTracks: String
val groupsAndStackSLMaterial: String
fun main(args: Array<String>)

RectSLKotlinEscapeTest.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLKotlinEscapeTest.kt — read the source

RectSLKotlinEscapeTest

object RectSLKotlinEscapeTest

Experimental: {{ … }} escapes let a RectSL program drop into a live with(Functions){ … } Kotlin scope anywhere a value is expected — the escape evaluates once (K2), is cached by source, and pushes a Number, an Fn, or a Track<Double> onto the stack. This exercises the whole path with a real engine.

Declaration Summary
fun main(args: Array<String>)

RectSLMusicWorkout.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLMusicWorkout.kt — read the source

RectSLMusicWorkout

object RectSLMusicWorkout

The musical layer's contract, asserted rather than asserted-to-be-true.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

RectSLStudyGpuSmoke.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLStudyGpuSmoke.kt — read the source

RectSLStudyGpuSmoke

object RectSLStudyGpuSmoke

Proof that a RectSL study's GPU frames are the scene's frames: the same scenes drawn by afield.lang.rectsl.study.RectSLGpuRasterizer on a live renderer and by the CPU reference agree, and a few pixels are pinned outright — so a flip, a colour written without its sRGB decode, a target that does not blend, or a stale time fails here rather than in a picture a model is shown.

Declaration Summary
val SCENES: List<Triple<String, String, List<Pair<List<Double>, Int>>>> Scenes, each with pixels (wall x, y, time) whose shown colour is pinned.
fun run(rasterizer: RectSLRasterizer, sheet: File): String Compare, pin, time and — if everything holds — write sheet. Returns a one-line summary; throws on a failure.

RectSLWorkout.kt

src/jvmMain/kotlin/afield/examples/rectsl/RectSLWorkout.kt — read the source

RectSLWorkout

object RectSLWorkout

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

slideshow_example.kt

Example slideshows demonstrating the slideshow DSL

To use these, create boxes in Field and run the code in one of them. The slideshow will guide users through the document.

NEW FEATURES: - Custom link callbacks: Links can execute Kotlin code via #custom:callbackName - Template system: Use {{propertyName}} to reference box properties/variables - Shared chat: Use withChat(id = "templateId") to share chat across template instances - Custom chat IDs: Create shared discussion spaces with custom IDs

See interactiveGuideExample() for a comprehensive demonstration of these features.

src/jvmMain/kotlin/afield/examples/slideshow_example.kt — read the source

Used in: Interactive Guides

Top-level functions

Declaration Summary
fun Box.simpleInteractiveExample() Simple example demonstrating custom link callbacks and templates
fun Box.exampleSlideShow() Example slideshow demonstrating the slideshow DSL
fun Box.simpleSlideShowExample() Simple example showing basic API usage
fun Box.slideShowWithImagesExample() Example showing how to use images in slideshow notes
fun Box.installSlideShowControls() Helper to install slideshow controls as actions on a box
fun Box.advancedSlideShowExample() Advanced slideshow example with annotations and animations
fun Box.interactiveGuideExample() Example demonstrating interactive links with callbacks and template system

SonicPiEditorExtensionWorkout.kt

src/jvmMain/kotlin/afield/examples/sonicpi/SonicPiEditorExtensionWorkout.kt — read the source

SonicPiEditorExtensionWorkout

object SonicPiEditorExtensionWorkout

Runs the shipped sonicpi.js under node against the shipped vocabulary.

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

SonicPiLinkAudioProbe.kt

src/jvmMain/kotlin/afield/examples/sonicpi/SonicPiLinkAudioProbe.kt — read the source

SonicPiLinkAudioProbe

object SonicPiLinkAudioProbe

Does Field's Ableton Link Audio actually interoperate with Sonic Pi v5's link_audio?

Declaration Summary
fun main(args: Array<String>)

SonicPiPatternProbe.kt

src/jvmMain/kotlin/afield/examples/sonicpi/SonicPiPatternProbe.kt — read the source

SonicPiPatternProbe

object SonicPiPatternProbe

Does a Field pattern lowered to Sonic Pi actually play where the pattern says it does?

Declaration Summary
fun main(args: Array<String>)

SonicPiSoundDocs.kt

src/jvmMain/kotlin/afield/examples/sonicpi/SonicPiSoundDocs.kt — read the source

SonicPiSoundDocs

object SonicPiSoundDocs

The sound on the Sonic Pi page, recorded from a real Sonic Pi.

Declaration Summary
val BIKES The first box on the page, as the box sends it.
fun renderWav(name: String, outPath: String)

StackSLDocumentToolSmoke.kt

src/jvmMain/kotlin/afield/examples/stacksl/StackSLDocumentToolSmoke.kt

StackSLEvolveGallery.kt

src/jvmMain/kotlin/afield/examples/stacksl/StackSLEvolveGallery.kt — read the source

StackSLEvolveGallery

object StackSLEvolveGallery

Verifies that evolving a StackSL program toward a picture finds programs that look like the picture, and that chance does not.

Declaration Summary
fun main(args: Array<String>)

StackSLSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stacksl/StackSLSmokeTest.kt — read the source

StackSLSmokeTest

object StackSLSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

StackSLStudyGpuSmoke.kt

src/jvmMain/kotlin/afield/examples/stacksl/StackSLStudyGpuSmoke.kt — read the source

StackSLStudyGpuSmoke

object StackSLStudyGpuSmoke

Proof that a StackSL study's GPU frames are the program's frames: the same programs rendered by afield.lang.stacksl.study.StackSLGpuRasterizer on a live renderer and by the CPU reference. Exact arithmetic, smooth-transcendental tiers, and the 2D fBm palette have hard bounds; the 4D fbm4 hash comparison remains diagnostic because tiny differences in its warped coordinates can cross hash lattice boundaries. uv saturate must be bit-identical, which catches a flipped image.

Declaration Summary
val PROGRAMS Programs spanning the four single-pass agreement tiers.
fun run(rasterizer: StackSLRasterizer, sheet: File): String Compare, time and — if everything holds — write sheet. Returns a one-line summary; throws on a failure.

StackSLWatchmakerTrial.kt

src/jvmMain/kotlin/afield/examples/stacksl/StackSLWatchmakerTrial.kt — read the source

StackSLWatchmakerTrial

object StackSLWatchmakerTrial

Does the watchmaker help? Every arm gets the same render budget on the same targets, and every result is judged by one referee none of them optimised as such (LPIPS at 32 px over the whole picture) and by the held-out layout check at 32 and 128 px.

Declaration Summary
data class ArmResult(val seed: Long, val target: String, val arm: String, val program: String, val refereeSkill: Double, val layout32: Double, val layout128: Double, val renders: Int, val seconds: Double, val notes: List<String> = emptyList(), val credit: Map<String, String> = emptyMap(), val usage: String = "")
const val LLM_ONLY_CALLS Model calls the llm-only arm stops at: what frequent averaged per run at 1,200 renders.
fun heldOut(name: String, dim: Int): StackSLTarget? Targets nothing was tuned on. The watchmaker's prompt was revised while looking at runs on the five built-in targets, so a result on those alone could be a prompt fitted to them; these were written afterwards and never looked at before the run that measured them.
fun targetAt(name: String, dim: Int): StackSLTarget A built-in target or a held-out one.
fun figure(results: File, arms: List<String>, seed: Long, targets: List<String>?, side: Int, out: File, labels: List<String> = arms) A figure from a finished trial: one row per target, the target and then each of arms's best program from seed, re-rendered at side px from the program text the trial recorded.
fun curves(dirs: List<File>, out: File, side: Int = 128) Resemblance over time, for a plot: every saved run in dirs (s<seed>-<target>-<arm>.json), every new best program it found, with the renders it took, that program's layout agreement at side px and its skill under the trial's one referee (LPIPS at 32 px over the whole picture, the same for every stage and arm), as CSV rows arm,target,seed,generation,renders,layout,skill,origin.
fun main(args: Array<String>)

VolumetricNoisePreview.kt

src/jvmMain/kotlin/afield/examples/stacksl/VolumetricNoisePreview.kt — read the source

VolumetricNoisePreview

object VolumetricNoisePreview

Draws the figure that settles the argument this branch is about, on the CPU, with no device.

Declaration Summary
fun legacy2dFbmWord(x: Float, y: Float, z: Float): Float What input fbm actually computes for input = vec4(x, y, z, 0).
fun main(args: Array<String>)

AlifeEvolveGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/AlifeEvolveGallery.kt — read the source

AlifeEvolveGallery

object AlifeEvolveGallery

Renders — and verifies — the claim that evolution beats chance on ALife rule spaces.

Declaration Summary
fun main(args: Array<String>)

AlifeGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/AlifeGallery.kt — read the source

AlifeGallery

object AlifeGallery

Renders — and verifies — the figures behind public/docs/alife_examples.md.

Declaration Summary
fun main(args: Array<String>)

AlifeScriptGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/AlifeScriptGallery.kt — read the source

AlifeScriptGallery

object AlifeScriptGallery

Renders — and verifies — the two claims alife_script.kt makes: that a scripted run is reproducible, and that per-agent scripting buys something a global rule cannot.

Declaration Summary
fun main(args: Array<String>)

AlifeWallsGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/AlifeWallsGallery.kt — read the source

AlifeWallsGallery

object AlifeWallsGallery

Renders — and verifies — the three claims alife_walls.kt makes: that the collision is swept rather than discrete, that the routing is deterministic, and that a routed seek reaches places a direct seek does not.

Declaration Summary
fun main(args: Array<String>)

DynamicGraphSystemsExample.kt

src/jvmMain/kotlin/afield/examples/stdlib/DynamicGraphSystemsExample.kt — read the source

Top-level functions

Declaration Summary
fun dynamicStateOf(points: List<Vec3>, labels: List<Vec4>? = null, time: Float = 0f): DynamicPointState Helper to convert external data into the dynamic graph state used by the examples.
fun exampleDynamicGraphPipeline(points: List<Vec3>, labels: List<Vec4>? = null): PointGraph Example: use a dynamic graph system, then snapshot into PointGraph so existing traversal / cover / diameter / A* code can operate unchanged.
fun exampleSystemSwitching(points: List<Vec3>, labels: List<Vec4>? = null): PointGraph Example: switch systems over time while keeping the same dynamic edge store.
fun exampleDynamicGraphToPathCover(points: List<Vec3>, labels: List<Vec4>? = null, anchor: Int = 0): GraphPathSetResult Example: snapshot into PointGraph, then reuse the existing path utilities.

FileManagerSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/FileManagerSmokeTest.kt — read the source

FileManagerSmokeTest

object FileManagerSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

GraphConnectivityExample.kt

src/jvmMain/kotlin/afield/examples/stdlib/GraphConnectivityExample.kt — read the source

GraphConnectivityExample

object GraphConnectivityExample

Example demonstrating the graph connectivity library usage.

Declaration Summary
fun main(args: Array<String>)

GraphConnectivitySmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/GraphConnectivitySmokeTest.kt — read the source

GraphConnectivitySmokeTest

object GraphConnectivitySmokeTest

Smoke tests for the graph connectivity library.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

InteractionNetsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/InteractionNetsSmokeTest.kt — read the source

InteractionNetsSmokeTest

object InteractionNetsSmokeTest

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

LambdaNetFigure.kt

src/jvmMain/kotlin/afield/examples/stdlib/LambdaNetFigure.kt — read the source

LambdaNetFigure

object LambdaNetFigure

Writes the figure for dev_docs/INTERACTION_NETS_LAMBDA.md: one reduction, one panel per step, left to right.

Declaration Summary
fun main(args: Array<String>)

LambdaPropertyOracleTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/LambdaPropertyOracleTest.kt — read the source

LambdaPropertyOracleTest

object LambdaPropertyOracleTest

The property harness that turns dev_docs/INTERACTION_NETS_LAMBDA.md's "measurement over 25 terms, not a proof" into a number with a population.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)
fun marksIn(term: Term): Set<String> Every mark in term, which is LambdaTerms.marksOf and no longer a second copy of it.
fun shrink(term: Term, rounds: Int = 400, stillFails: (Term) -> Boolean): Term The smallest closed term this can reach that still satisfies stillFails, by greedy descent.

LambdaTermGenerator.kt

src/jvmMain/kotlin/afield/examples/stdlib/LambdaTermGenerator.kt — read the source

LambdaTermGenerator

object LambdaTermGenerator

A seeded generator of closed λ-terms for property-testing afield.lang.lambda.LambdaTerms, in two families whose distributions are a printed deliverable rather than a footnote.

Declaration Summary
sealed interface Ty A simple type over the single base type o. Only needed by Family T, and only to keep it terminating.
val O: Ty o — the one base type.
fun arr(a: Ty, b: Ty): Ty a``→``b.
fun showTy(t: Ty): String A type as text: (o→o)→o→o, arrows to the right.
fun typedTerms(seed: Long, count: Int, sizeFloor: Int = 6, sizeCeiling: Int = 26, duplicationBias: Double = 4.0): List<Term> count closed simply-typed terms from seed.
val SOUP_POOL: List<Pair<String, String>> The closed combinators Family D applies to one another, as source text, weighted by repetition.
fun soupTerms(seed: Long, count: Int, maxDepth: Int = 2): List<Term> count closed untyped applications over SOUP_POOL, from seed.
class Population(val label: String, val seed: Long, val terms: List<Term>) What a generated population actually is, so that a claim about it carries its own evidence.
fun nodeCount(term: Term): Int Nodes in term — variables, abstractions and applications counted alike.
fun lambdaDepth(term: Term): Int The deepest nesting of λs in term.

LambdaTermsSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/LambdaTermsSmokeTest.kt — read the source

LambdaTermsSmokeTest

object LambdaTermsSmokeTest

The oracle harness for afield.lang.lambda.LambdaTerms.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

LeastSquaresAndFMChirpSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/LeastSquaresAndFMChirpSmokeTest.kt — read the source

LeastSquaresAndFMChirpSmokeTest

object LeastSquaresAndFMChirpSmokeTest

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

SavedJsonSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/SavedJsonSmokeTest.kt — read the source

SavedJsonSmokeTest

object SavedJsonSmokeTest

Declaration Summary
fun main(args: Array<String>)
fun runTests(): Boolean

SmileStdlibSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/SmileStdlibSmokeTest.kt — read the source

SmileStdlibSmokeTest

object SmileStdlibSmokeTest

Focused smoke tests for Smile-backed stdlib helpers.

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

TypographyGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/TypographyGallery.kt — read the source

TypographyGallery

object TypographyGallery

The typography family, one PNG per claim, all of it CPU.

Declaration Summary
fun main(args: Array<String>)

WfcGallery.kt

src/jvmMain/kotlin/afield/examples/stdlib/WfcGallery.kt — read the source

WfcGallery

object WfcGallery

Renders — and verifies — the figures behind [public/docs/wfc_examples.md].

Declaration Summary
const val DEEP Terrain IDs, in the order that makes them a chain: each may only touch its neighbours.
const val SHALLOW
const val SAND
const val GRASS
const val FOREST
const val TERRAIN_COUNT
val TERRAIN_COLORS ARGB, opaque. Chosen so the five bands are unambiguous at one pixel per cell.
val TERRAIN_NAMES
fun terrainMap(w: Int, h: Int): IntArray A quantised smooth elevation field: three overlapping bumps sliced into five bands.
fun terrainTile(terrain: Int, tileSide: Int): IntArray One 8x8 tile per terrain: a flat base plus a fixed dither.
fun terrainPixelImg(w: Int, h: Int): Img The terrain map at one pixel per cell — the source the overlapping model reads.
fun terrainTiledImg(w: Int, h: Int, tileSide: Int = 8): Img The terrain map with each cell drawn as an 8x8 textured tile — the simple-tiled source.
val SKY
val SOIL
val STEM
val BLOSSOM
const val FLOWERS_SOIL_TOP Row at which soil starts in flowersSource; everything above it is sky, stem or blossom.
fun flowersSource(w: Int = 26, h: Int = 18): IntArray The overlapping model's source: sky over soil, with a few flowers rooted in the soil.
fun flowersImg(w: Int = 26, h: Int = 18): Img flowersSource as an Img.
val CIRCUIT_SOCKETS Socket per edge, in WFC_NORTH, WFC_EAST, WFC_SOUTH, WFC_WEST order; 1 = a trace leaves here.
val CIRCUIT_NAMES
fun circuitRules(): WfcRules Rules from edge sockets: b may sit east of a exactly when a's east socket matches b's west socket. This is the original "simple tiled model", stated directly instead of inferred.
fun circuitTile(tile: Int, side: Int = 11): IntArray 11x11 tile art for the circuit set: a centre pad plus a trace out to each live socket.
fun circuitTileSet(side: Int = 11): PngTileSet A PngTileSet assembled from hand-drawn art rather than sliced from a source image.
fun checkOutputSatisfiesRules(label: String, rules: WfcRules, grid: IntArray, w: Int, h: Int) The invariant that matters: every adjacent pair in grid must be allowed by rules.
fun checkNotDegenerate(label: String, grid: IntArray, tileCount: Int, minDistinct: Int, maxShare: Double) Guards the two failure modes that still look like a picture: one tile everywhere, or noise.
fun checkSymmetric(label: String, rules: WfcRules) Adjacency must be a symmetric relation or the solver cannot enforce it. See WfcRules.findAsymmetry.
fun checkOutputUsesObservedPairsOnly(label: String, rules: WfcRules, grid: IntArray, w: Int, h: Int, maxInvented: Int = 0) The stronger form of checkOutputSatisfiesRules: every adjacent pair must be a pair the sample actually contained, not merely one the widened table permits.
fun terrainPairs(terrain: IntArray, w: Int, h: Int): Set<Pair<Int, Int>> The unordered set of terrain pairs that touch (east or south) in a terrain grid.
fun checkStructureReused(label: String, source: IntArray, sw: Int, sh: Int, output: IntArray, ow: Int, oh: Int) The human-legible form of "it reused the source's structure": the output may only contain terrain edges the source contained.
fun coherence(grid: IntArray, w: Int, h: Int): Double Fraction of 4-adjacent cell pairs that hold the same value — "how blobby is this".
fun floatingBlossoms(pixels: IntArray, w: Int, h: Int): Int Which output pixels are blossoms whose pixel directly below is not a stem.
fun meanBranching(rules: WfcRules): Double Mean number of tiles allowed per (direction, tile) — the model's branching factor.
val STRIPE_COLORS
fun diagonalStripeSource(w: Int, h: Int): IntArray Diagonal stripes two cells wide — a source built so the neighborhood choice provably matters.
fun diagonalStripeImg(w: Int, h: Int, tileSide: Int = 8): Img diagonalStripeSource drawn as flat 8x8 tiles.
fun antiDiagonalBreaks(grid: IntArray, w: Int, h: Int): Int How many cells break "the anti-diagonal neighbour has the same tile" — 0 means clean stripes.
fun quantisedField(w: Int, h: Int, levels: Int): FloatArray Quantised smooth field, the source both float paths learn from.
fun roughness(values: FloatArray, w: Int, h: Int): Pair<Double, Double> Mean absolute difference between horizontally / vertically adjacent values.
fun main(args: Array<String>)

WfcSmokeTest.kt

src/jvmMain/kotlin/afield/examples/stdlib/WfcSmokeTest.kt — read the source

WfcSmokeTest

object WfcSmokeTest

Declaration Summary
fun runTests(): Boolean
fun main(args: Array<String>)

BinauralQualityProbe.kt

src/jvmMain/kotlin/afield/examples/steamaudio/BinauralQualityProbe.kt — read the source

Top-level functions

Declaration Summary
fun main()

CaveDemo.kt

src/jvmMain/kotlin/afield/examples/steamaudio/CaveDemo.kt — read the source

Top-level functions

Declaration Summary
fun main()

GeometryBenchmark.kt

src/jvmMain/kotlin/afield/examples/steamaudio/GeometryBenchmark.kt — read the source

Top-level functions

Declaration Summary
fun main()

HeadTrackedPatternDemo.kt

src/jvmMain/kotlin/afield/examples/steamaudio/HeadTrackedPatternDemo.kt — read the source

Top-level functions

Declaration Summary
fun headTrackedPose(frame: Long, movementFrames: Long, sampleRate: Int): HeadPose Where the head is at render frame frame, for movements of movementFrames each.
fun renderHeadTracked(movementSeconds: Double = MOVEMENT_SECONDS, sampleRate: Int = SAMPLING_RATE): HeadTrackedRender Renders the four movements, movementSeconds each, and returns the audio.
fun main()

HeadTrackedRender

class HeadTrackedRender(val interleaved: FloatArray, val sampleRate: Int, val readout: List<String>)

A finished render: interleaved stereo at sampleRate, plus a readout line per movement.

HrtfProbe.kt

src/jvmMain/kotlin/afield/examples/steamaudio/HrtfProbe.kt — read the source

Top-level functions

Declaration Summary
fun main() Measures the binaural effect directly: feeds a single impulse from a series of azimuths and reports the per-ear arrival delay and level.

OrbitDemo.kt

src/jvmMain/kotlin/afield/examples/steamaudio/OrbitDemo.kt — read the source

Top-level functions

Declaration Summary
fun main()

PackagingVerifier.kt

src/jvmMain/kotlin/afield/examples/steamaudio/PackagingVerifier.kt — read the source

Top-level functions

Declaration Summary
fun main() Verifies the published packaging from a consumer's position.

PathingDemo.kt

src/jvmMain/kotlin/afield/examples/steamaudio/PathingDemo.kt — read the source

Top-level functions

Declaration Summary
fun main()

ReflectionHandednessProbe.kt

src/jvmMain/kotlin/afield/examples/steamaudio/ReflectionHandednessProbe.kt — read the source

Top-level functions

Declaration Summary
fun main()

WavWriter.kt

src/jvmMain/kotlin/afield/examples/steamaudio/WavWriter.kt — read the source

SliderTest.kt

Test file demonstrating the slider functionality. This can be used as a reference or executed in a Field4 box.

src/jvmMain/kotlin/afield/examples/tests/SliderTest.kt — read the source

Top-level functions

Declaration Summary
fun Box.testSimpleSlider()
suspend fun Box.testMultipleSliders()
fun Box.testColorMixer()
suspend fun Box.testAnimationParams()

AudioVideoExample.kt

AudioVideoExample demonstrates synchronized audio/video playback with clock integration.

src/jvmMain/kotlin/afield/examples/video/AudioVideoExample.kt — read the source

Top-level functions

Declaration Summary
fun basicAudioVideoPlaybackWithClock()

ParticlePolylineExport.kt

src/jvmMain/kotlin/afield/examples/video/ParticlePolylineExport.kt — read the source

ParticlePolylineExport

object ParticlePolylineExport

Export actual cached trajectories as line-only diagnostic movies, without rerunning inference.

Declaration Summary
fun main(args: Array<String>)

ParticleTrackerSmoke.kt

src/jvmMain/kotlin/afield/examples/video/ParticleTrackerSmoke.kt — read the source

ParticleTrackerSmoke

object ParticleTrackerSmoke

Explicit optional CUDA check, never run by ordinary Field startup or portable test suites. Pass a local video and an output directory. It exercises Kotlin -> Python -> RAFT -> C++ -> strict Kotlin reader -> Kotlin raster/movie, cache reuse and coroutine cancellation.

Declaration Summary
fun main(args: Array<String>)

VideoTextureExample.kt

src/jvmMain/kotlin/afield/examples/video/VideoTextureExample.kt — read the source

VideoTextureExample

object VideoTextureExample

Example usage of VideoTexture.

Declaration Summary
fun basicPlayback(renderer: Renderer, videoPath: String) Basic video playback example.
fun multipleVideos(renderer: Renderer, videoPath1: String, videoPath2: String) Example of loading multiple videos with resource reuse.
fun renderLoopIntegration(renderer: Renderer, videoPath: String, onFrame: (CommandBuffer, VideoTexture) -> Unit) Example of frame-by-frame rendering integration.
fun scrubExample(renderer: Renderer, videoPath: String) Example of seeking and frame scrubbing.

ChartGallery.kt

src/jvmMain/kotlin/afield/examples/visualization/ChartGallery.kt — read the source

ChartGallery

object ChartGallery

Headless capture harness for Chart — the vehicle that takes the primitive all the way to pixels.

Declaration Summary
fun main(args: Array<String>)