import { todo } from './todo.js' import { pure } from './io.js' /** Milliseconds between game steps. */ export const TICK_MS = 150 /** Milliseconds between animation frames (m10). */ export const FRAME_MS = 25 /** * 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') } /** * (m10) Like `classicActions`, but the clock emits `Action.Frame` every FRAME_MS instead of `Tick` every TICK_MS; * key presses are translated by `keyToAction` as before (now including pause and restart). */ export const speedActions = { step: () => todo('m10') } /** * 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>>`: ask for a random seed, then turn the stream of * states (built from `classicActions` in m09, from `speedActions` after m10) into a stream of drawings (`render`). * Nothing runs here. */ export const main = pure({ step: () => todo('m09') })