Multi-core simulation: grain movement and heat across a worker pool (t88 phase 3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-28 03:23:43 -04:00
co-authored by Claude Opus 5.5
parent 20963c776e
commit 7468d00efb
35 changed files with 578 additions and 113 deletions
+5 -1
View File
@@ -35,9 +35,13 @@ def main():
shell = (src / man['shell']).read_text()
css, _ = join(man['css'])
js, starts = join(man['sim'] + man['client'])
sim, _ = join(man['sim'])
# Keep worker code outside the indexed script so source line mappings stay exact.
worker = '<script>const SIM_WORKER_SOURCE=' + json.dumps(sim).replace('</', '<\\/') + ';</script>'
head, tail = shell.split('//__JS__')
body = head.replace('/*__CSS__*/', css)
page = body + js + tail
page = worker + page
pre = ('<!doctype html><html><head><meta charset="utf-8">'
'<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">'
'</head><body>')
@@ -46,7 +50,7 @@ def main():
(dist / 'deepgrain-foundry.html').write_text(page)
(dist / 'index.html').write_text(full)
# the script starts on this line of index.html (the doctype prefix has no newlines)
js_line = body.count('\n') + 1
js_line = worker.count('\n') + body.count('\n') + 1
(dist / 'bundle-lines.json').write_text(json.dumps(
{'page': 'dist/index.html', 'files': [[js_line + s - 1, f] for s, f in starts]}, indent=1) + '\n')
print(f'built dist/index.html ({len(full):,} bytes, {len(starts)} source files)')