feat(js): m09 input, app, runtime, browser, main, index.html and smoke test

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-28 23:53:09 +01:00
co-authored by Claude Sonnet 5.5
parent 584f1d4825
commit 8028bb2fc0
16 changed files with 622 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { todo } from './todo.js'
import { pure } from './io.js'
/** Milliseconds between game steps. */
export const TICK_MS = 150
/**
* Stream of everything that can happen to the game: `Action.Tick` every TICK_MS (from `interval`),
* merged with the `Action` for each key press that `keyToAction` recognises (from `keyDowns`).
*/
export const classicActions = { step: () => todo('m09') }
/**
* Fold a stream of actions into a stream of game states: start from `newGame(seed)`, apply `update` to each action
* (scan), and emit the initial state first (startWith) so there is something to draw before anything happens.
*/
export const states = (seed, actions) => todo('m09')
/** The drawing of one state, as an IO: `drawScene(view(state))`. */
export const render = (state) => todo('m09')
/**
* The whole program as a value, `IO<Stream<IO<unit>>>`: ask for a random seed, then turn the stream of
* states (built from `classicActions`) into a stream of drawings (`render`). Nothing runs here.
*/
export const main = pure({ step: () => todo('m09') })