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:
@@ -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)')
|
||||
|
||||
Reference in New Issue
Block a user