Module 9 lesson, scenarios, tests (8, both tracks), reference engines (TURN phase list, conversion, content-registered hazards, win/lost), WEAK Expansion Drop, harness.md M9 semantics, research notes (WEAK page, baba-is-auto Game::MovePlayer, X IS NOT X placement reading). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
/// <reference types="vite/client" />
|
||
// Content: the cards and the Baba Is You words. Only this directory (and the card
|
||
// data in `cards/`) may name specific cards, or specific Baba Is You nouns.
|
||
//
|
||
// From Module 5 every card is a JSON file in `cards/` at the package root, in the
|
||
// course's card format (`course/schema/card.schema.json`). The functions that were
|
||
// card effects in Modules 2–4 are gone: the engine interprets the data.
|
||
// `start-module` copies the course's card files into `cards/`; add your own there.
|
||
//
|
||
// `import.meta.glob` is Vite's (Vitest runs on Vite): it imports every matching
|
||
// JSON file when this module loads, so no file system code is needed.
|
||
|
||
import type { CardDef, puzzle } from "../engine";
|
||
import wordList from "./words.json";
|
||
|
||
export { hazards } from "./hazards";
|
||
export { responses as movement } from "./movement";
|
||
|
||
const files = import.meta.glob<CardDef>("../../cards/*.json", { eager: true, import: "default" });
|
||
|
||
/** Every card in `cards/`, in file-name order. */
|
||
export function cards(): CardDef[] {
|
||
return Object.keys(files)
|
||
.sort()
|
||
.map((path) => files[path]);
|
||
}
|
||
|
||
/**
|
||
* Part II: the words of Baba Is You the parser can read, besides the engine's own
|
||
* (`IS`, `AND`, `NOT`, `TEXT`). Nouns and properties are data: a new word is one
|
||
* more entry in `words.json` in this directory.
|
||
*/
|
||
export function words(): puzzle.WordDef[] {
|
||
return wordList as puzzle.WordDef[];
|
||
}
|