feat(js): m10 extensions (pause, restart, speed-up via Frame) with tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
25141ce86d
commit
fd7c5f2acf
+14
-2
@@ -1,9 +1,21 @@
|
||||
import { todo } from './todo.js'
|
||||
|
||||
/**
|
||||
* How many frames pass between game steps (m10): `max(2, 8 - floor(score / 3))`.
|
||||
* Score 0-2 -> 8, 3-5 -> 7, ..., 18 and up -> 2.
|
||||
*/
|
||||
export const movesEvery = (score) => todo('m10')
|
||||
|
||||
/**
|
||||
* The one function that says how the game changes: `(state, action) -> state`.
|
||||
* `Tick` runs a game step (`tick`), `Turn` asks to change direction (`turn`);
|
||||
* every other action returns the state unchanged for now.
|
||||
*
|
||||
* m05: `Tick` runs a game step (`tick`), `Turn` asks to change direction (`turn`);
|
||||
* every other action returns the state unchanged.
|
||||
*
|
||||
* (m10) `TogglePause` switches Playing <-> Paused and does nothing in any other status.
|
||||
* (m10) `Restart` gives `newGame(state.seed)`, whatever the status.
|
||||
* (m10) `Frame` does nothing unless Playing; otherwise it adds 1 to `frame`, and when the new `frame` is a multiple of
|
||||
* `movesEvery(score)` it also runs a game step (`tick`) on that incremented state.
|
||||
*/
|
||||
export const update = (state, action) => todo('m05')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user