gol.qip

View all files

Activity

Contributors

README

Game of Life

Requires Zig 0.17 and Node.js.

  • zig build builds zig-out/bin/component.wasm.
  • zig build run runs the freshly built component with npx qiptui.
  • zig build web serves the same component at http://127.0.0.1:8080.
  • zig build web -- --port 8081 selects another browser server port.
  • zig build -Doptimize=small selects size optimization; the default is stripped ReleaseFast.

The browser page uses QIP's official <qip-tui> element, served by qip-router@0.1.3. zig build web assembles a site in Zig's build cache with the freshly built game at component.wasm, local browser modules in _elements/, and the ANSI renderer in text/. Router serves these at /component.wasm, /elements/, and /text/. The published router 0.1.3 still prefixes its reserved component assets with /components/, so the Wasm files use ordinary static routes to match the browser runtime.

The official browser assets are copied from https://qip.dev and retain their Apache-2.0 license in web/LICENSE-QIP. No proxy or runtime asset downloads are needed. The first run of the router command requires npm registry access; subsequent runs can use the npm cache. QIP owns the timed update, presentation, and keyboard lifecycle. Stop the server with Ctrl+C; rerun zig build web after source changes and reload the page.

The text styling currently fits an 80 × 255 board without scrolling; update the dimensions in web/index.html if the board dimensions change.

The component reserves 4 KiB of stack and one 64 KiB Wasm memory page.

License

Original project code is licensed under the MIT License; see LICENSE. The copied QIP assets in web/_elements/, web/qip-runner.js, and web/text/ansi-sgr-to-html.wasm remain licensed under Apache-2.0; see web/LICENSE-QIP.