Research-Stack/5-Applications/tools-scripts/demo/gwl_hello_world_example.gwl

62 lines
1.7 KiB
Text

// GPL Hello World Example
// A simple program demonstrating geometric programming
PROGRAM hello_world {
// Declare input nodes on the surface (I/O ports)
INPUT μ_trigger [region: SURFACE, chirality: D]
// Internal computation nodes
INTERNAL μ_process [region: INTERIOR]
INTERNAL μ_buffer [region: INTERIOR, chirality: L]
// Output nodes
OUTPUT μ_result [region: SURFACE]
// PROGRAM LOGIC:
// When triggered, activate a pattern in the interior
// Propagate to output when stable
// Trigger activation flow
μ_trigger
-> ACCUMULATE
-> μ_process
// Processing with noise (exploration)
μ_process
-> NOISE
-> μ_buffer
// Stabilization and output
μ_buffer
-> COLLAPSE
-> μ_result
// Configuration:
// - Trigger starts at activation 8 (ACTIVE)
// - Process accumulates with weight 0.5
// - Buffer adds controlled noise (variance 0.3)
// - Result collapses when confidence > 0.7
INITIALIZE {
μ_trigger.activation = 8 // Start active
μ_process.activation = 0 // Start quiescent
μ_buffer.activation = 0 // Start quiescent
μ_result.activation = 0 // Start quiescent
μ_trigger.confidence = 15 // High confidence
μ_process.confidence = 8 // Medium confidence
}
CONVERGE {
max_cycles = 1000
variance_threshold = 0.1
mode = NORMAL // Allow noise
}
EXTRACT {
// Result is in μ_result.activation
// Map 0-15 to ASCII range
output_value = μ_result.activation * 16
}
}