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
+12
View File
@@ -0,0 +1,12 @@
import { Action } from './model.js'
// Key name (as in KeyboardEvent.key) -> direction. A lookup table keeps keyToAction a one-liner.
const directions = {
ArrowUp: 'Up', w: 'Up', W: 'Up',
ArrowDown: 'Down', s: 'Down', S: 'Down',
ArrowLeft: 'Left', a: 'Left', A: 'Left',
ArrowRight: 'Right', d: 'Right', D: 'Right',
}
export const keyToAction = (key) =>
Object.hasOwn(directions, key) ? Action.Turn(directions[key]) : null