tag:github.com,2008:https://github.com/oisee/psil/releases
Release notes from psil
2026-03-04T17:39:49Z
tag:github.com,2008:Repository/1131909287/v0.14.0
2026-03-04T17:40:32Z
Z80 Sandbox Evolutionary Upgrade — Phase 1
<h2>Z80 NPC Sandbox v2: Real Evolutionary Mechanics</h2>
<p>Major upgrade to the Z80 sandbox simulation with 9 actions, real sensors, and tournament GA.</p>
<h3>What's new</h3>
<ul>
<li><strong>32×24 world</strong> with separate tile + occupancy grids</li>
<li><strong>5×5 neighborhood scan</strong> — NPCs sense nearest food, NPC, and item (distance + direction)</li>
<li><strong>9 actions</strong>: eat, attack, heal, harvest, terraform, share, trade, craft, teach</li>
<li><strong>Tournament-3 GA</strong> with single-point crossover and 3 mutation types (point/insert/delete)</li>
<li><strong>Dead NPC respawn</strong> — GA clones+mutates survivors to refill population</li>
<li><strong>128K bank switching</strong> — genomes in Bank 0 ($C000), SP at $BFFE in Bank 2</li>
<li><strong>Item system</strong> — pickup on movement, drop on death, bilateral trade resolution</li>
</ul>
<h3>Stats</h3>
<ul>
<li>Binary: 4,669 bytes (was 2,818)</li>
<li>Population stabilizes at ~9 NPCs with sustained eating behavior</li>
<li>Fitness grows from 146 to 426+ over 256 ticks</li>
</ul>
<h3>Run</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mzx --run sandbox.bin@8000 --console-io --frames DI:HALT --max-frames 2000000"><pre>mzx --run sandbox.bin@8000 --console-io --frames DI:HALT --max-frames 2000000</pre></div>
<h3>Sample output</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="NPC Sandbox Z80 v2
T=16 A=16 F=146 E=9
T=32 A=16 F=172 E=6
T=48 A=2 F=158 E=6
T=64 A=3 F=184 E=1
...
T=224 A=10 F=394 E=1
T=256 A=4 F=426 E=0"><pre class="notranslate"><code>NPC Sandbox Z80 v2
T=16 A=16 F=146 E=9
T=32 A=16 F=172 E=6
T=48 A=2 F=158 E=6
T=64 A=3 F=184 E=1
...
T=224 A=10 F=394 E=1
T=256 A=4 F=426 E=0
</code></pre></div>
<p>Phase 2 (items/economy) and Phase 3 (WFC biomes) coming next.</p>
oisee
tag:github.com,2008:Repository/1131909287/v0.3.0
2026-02-27T23:00:00Z
v0.3.0 — Evolving Bytecode Brains
<h2>NPC Sandbox: Evolving Bytecode Brains</h2>
<p>A genetic programming sandbox where NPCs with micro-PSIL bytecode genomes live in a 32×32 tile world, sense their environment, make decisions, and evolve. Runs on both Go and Z80.</p>
<h3>What's New</h3>
<ul>
<li><strong>Go sandbox</strong> (<code>pkg/sandbox/</code>) — full simulation with 20 NPCs, tournament selection, instruction-aligned crossover, and 6 mutation operators</li>
<li><strong>Z80 sandbox</strong> (<code>z80/sandbox.asm</code>) — 2,818 bytes of machine code running 16 NPCs with evolution on a Z80</li>
<li><strong>GA engine</strong> (<code>pkg/sandbox/ga.go</code>) — point mutation, insert, delete, constant tweak, block swap, block duplicate</li>
<li><strong>CLI runner</strong> (<code>cmd/sandbox/main.go</code>) — configurable population size, tick count, gas limit, evolution frequency</li>
<li><strong>Seed genomes</strong> — forager, flee, and random walker programs in <code>testdata/sandbox/</code></li>
<li><strong>Cross-validation</strong> — identical Ring1 outputs verified between Go and Z80 VMs</li>
<li><strong>VM enhancements</strong> — Ring0R/Ring1R/Ring1W/Gas/Yield opcodes in Z80 dispatcher, per-step gas limiting, mute flag</li>
</ul>
<h3>Quick Start</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# Go sandbox
go run ./cmd/sandbox --npcs 20 --ticks 5000 --seed 42 --verbose
# Z80 sandbox
sjasmplus z80/sandbox.asm --raw=z80/build/sandbox.bin
mzx --run z80/build/sandbox.bin@8000 --console-io --frames DI:HALT"><pre><span class="pl-c"><span class="pl-c">#</span> Go sandbox</span>
go run ./cmd/sandbox --npcs 20 --ticks 5000 --seed 42 --verbose
<span class="pl-c"><span class="pl-c">#</span> Z80 sandbox</span>
sjasmplus z80/sandbox.asm --raw=z80/build/sandbox.bin
mzx --run z80/build/sandbox.bin@8000 --console-io --frames DI:HALT</pre></div>
<h3>Prebuilt Binaries</h3>
<table>
<thead>
<tr>
<th>File</th>
<th>Size</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>sandbox.bin</code></td>
<td>2,818 B</td>
<td>Z80 NPC sandbox (load at $8000)</td>
</tr>
<tr>
<td><code>vm.bin</code></td>
<td>1,674 B</td>
<td>Z80 micro-PSIL VM with Ring0/Ring1/Gas/Yield (load at $8000)</td>
</tr>
</tbody>
</table>
<h3>Test Results</h3>
<ul>
<li>11 Go tests passing (9 unit + 2 cross-validation)</li>
<li>4 Z80 test programs passing (arithmetic, hello, factorial, npc-thought)</li>
<li>Z80 sandbox runs: <code>NPC Sandbox Z80 → T=128 A=2 → T=256 A=0 → Done</code></li>
</ul>
<p>See <a href="/oisee/psil/blob/v0.3.0/docs/npc-sandbox-journey.md">docs/npc-sandbox-journey.md</a> for the full story.</p>
oisee