@johnmorrisdotca/houseki 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +79 -2
- package/dist/colour-chains/challenge.d.ts +3 -0
- package/dist/colour-chains/challenge.js +120 -0
- package/dist/colour-chains/content-data.d.ts +2 -0
- package/dist/colour-chains/content-data.js +9534 -0
- package/dist/colour-chains/content-types.d.ts +80 -0
- package/dist/colour-chains/content-types.js +1 -0
- package/dist/colour-chains/content.d.ts +11 -0
- package/dist/colour-chains/content.js +28 -0
- package/dist/colour-chains/engine.d.ts +19 -0
- package/dist/colour-chains/engine.js +493 -0
- package/dist/colour-chains/input.d.ts +24 -0
- package/dist/colour-chains/input.js +77 -0
- package/dist/colour-chains/match.d.ts +5 -0
- package/dist/colour-chains/match.js +48 -0
- package/dist/colour-chains/persistence.d.ts +7 -0
- package/dist/colour-chains/persistence.js +96 -0
- package/dist/colour-chains/random.d.ts +7 -0
- package/dist/colour-chains/random.js +49 -0
- package/dist/colour-chains/types.d.ts +191 -0
- package/dist/colour-chains/types.js +1 -0
- package/dist/colour-chains/validation.d.ts +16 -0
- package/dist/colour-chains/validation.js +80 -0
- package/dist/colour-chains.d.ts +8 -0
- package/dist/colour-chains.js +7 -0
- package/dist/falling-triplets/content-data.d.ts +7258 -0
- package/dist/falling-triplets/content-data.js +18073 -0
- package/dist/falling-triplets/content-types.d.ts +72 -0
- package/dist/falling-triplets/content-types.js +1 -0
- package/dist/falling-triplets/content.d.ts +11 -0
- package/dist/falling-triplets/content.js +39 -0
- package/dist/falling-triplets/engine.d.ts +26 -0
- package/dist/falling-triplets/engine.js +541 -0
- package/dist/falling-triplets/input.d.ts +18 -0
- package/dist/falling-triplets/input.js +41 -0
- package/dist/falling-triplets/match.d.ts +9 -0
- package/dist/falling-triplets/match.js +45 -0
- package/dist/falling-triplets/random.d.ts +9 -0
- package/dist/falling-triplets/random.js +44 -0
- package/dist/falling-triplets/types.d.ts +134 -0
- package/dist/falling-triplets/types.js +1 -0
- package/dist/falling-triplets.d.ts +7 -0
- package/dist/falling-triplets.js +6 -0
- package/dist/gem-swap/black-hole.d.ts +7 -0
- package/dist/gem-swap/black-hole.js +54 -0
- package/dist/gem-swap/board.d.ts +25 -0
- package/dist/gem-swap/board.js +89 -0
- package/dist/gem-swap/content.d.ts +75 -0
- package/dist/gem-swap/content.js +68 -0
- package/dist/gem-swap/engine.d.ts +25 -0
- package/dist/gem-swap/engine.js +689 -0
- package/dist/gem-swap/persistence.d.ts +17 -0
- package/dist/gem-swap/persistence.js +107 -0
- package/dist/gem-swap/practice.d.ts +4 -0
- package/dist/gem-swap/practice.js +57 -0
- package/dist/gem-swap/random.d.ts +9 -0
- package/dist/gem-swap/random.js +32 -0
- package/dist/gem-swap/specials.d.ts +13 -0
- package/dist/gem-swap/specials.js +300 -0
- package/dist/gem-swap/tools.d.ts +3 -0
- package/dist/gem-swap/tools.js +20 -0
- package/dist/gem-swap/types.d.ts +200 -0
- package/dist/gem-swap/types.js +1 -0
- package/dist/gem-swap.d.ts +5 -0
- package/dist/gem-swap.js +3 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/magnetic-blocks/engine.d.ts +11 -0
- package/dist/magnetic-blocks/engine.js +263 -0
- package/dist/magnetic-blocks/persistence.d.ts +7 -0
- package/dist/magnetic-blocks/persistence.js +104 -0
- package/dist/magnetic-blocks/physics.d.ts +30 -0
- package/dist/magnetic-blocks/physics.js +155 -0
- package/dist/magnetic-blocks/random.d.ts +6 -0
- package/dist/magnetic-blocks/random.js +19 -0
- package/dist/magnetic-blocks/types.d.ts +158 -0
- package/dist/magnetic-blocks/types.js +1 -0
- package/dist/magnetic-blocks/validation.d.ts +23 -0
- package/dist/magnetic-blocks/validation.js +121 -0
- package/dist/magnetic-blocks.d.ts +5 -0
- package/dist/magnetic-blocks.js +4 -0
- package/dist/nature/attraction.d.ts +5 -0
- package/dist/nature/attraction.js +136 -0
- package/dist/nature/environment.d.ts +91 -0
- package/dist/nature/environment.js +272 -0
- package/dist/nature/marking.d.ts +3 -0
- package/dist/nature/marking.js +39 -0
- package/dist/nature/random.d.ts +3 -0
- package/dist/nature/random.js +19 -0
- package/dist/nature/rebound.d.ts +5 -0
- package/dist/nature/rebound.js +98 -0
- package/dist/nature/state.d.ts +3 -0
- package/dist/nature/state.js +22 -0
- package/dist/nature/types.d.ts +124 -0
- package/dist/nature/types.js +1 -0
- package/dist/nature/validation.d.ts +10 -0
- package/dist/nature/validation.js +117 -0
- package/dist/nature.d.ts +8 -0
- package/dist/nature.js +7 -0
- package/dist/stone-collapse/content-data.d.ts +14218 -0
- package/dist/stone-collapse/content-data.js +25217 -0
- package/dist/stone-collapse/content-types.d.ts +77 -0
- package/dist/stone-collapse/content-types.js +1 -0
- package/dist/stone-collapse/content.d.ts +11 -0
- package/dist/stone-collapse/content.js +28 -0
- package/dist/stone-collapse/engine.d.ts +19 -0
- package/dist/stone-collapse/engine.js +570 -0
- package/dist/stone-collapse/persistence.d.ts +7 -0
- package/dist/stone-collapse/persistence.js +230 -0
- package/dist/stone-collapse/types.d.ts +216 -0
- package/dist/stone-collapse/types.js +1 -0
- package/dist/stone-collapse/validation.d.ts +21 -0
- package/dist/stone-collapse/validation.js +135 -0
- package/dist/stone-collapse.d.ts +6 -0
- package/dist/stone-collapse.js +4 -0
- package/package.json +96 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ChallengeGoal, ChallengeHint, Colour, Gem, Triplet } from './types.js';
|
|
2
|
+
export interface LocalizedText {
|
|
3
|
+
readonly en: string;
|
|
4
|
+
readonly ja: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DifficultyMetrics {
|
|
7
|
+
readonly seededGoalSuccesses: number;
|
|
8
|
+
readonly seededGoalSamples: number;
|
|
9
|
+
readonly seededGoalSuccessRate: number;
|
|
10
|
+
readonly legalChoiceBreadth: number;
|
|
11
|
+
readonly goalPreservingChoices: number;
|
|
12
|
+
readonly probedChoices: number;
|
|
13
|
+
readonly goalPreservingChoiceShare: number;
|
|
14
|
+
readonly forcedChoiceShare: number;
|
|
15
|
+
readonly setupPiecesBeforePayoff: number;
|
|
16
|
+
readonly requiredChainDepth: number;
|
|
17
|
+
readonly witnessPlanningLength: number;
|
|
18
|
+
readonly payoffDirections: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CampaignLevel {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly seed: string;
|
|
23
|
+
readonly number: number;
|
|
24
|
+
readonly title: LocalizedText;
|
|
25
|
+
/** SHA-256 fingerprint of the colour- and mirror-canonical duplicate key. */
|
|
26
|
+
readonly canonicalKeyHash: string;
|
|
27
|
+
readonly width: number;
|
|
28
|
+
readonly height: number;
|
|
29
|
+
readonly colourCount: 4 | 5 | 6;
|
|
30
|
+
readonly goal: ChallengeGoal;
|
|
31
|
+
readonly board: readonly (Gem | null)[];
|
|
32
|
+
readonly queue: readonly Triplet[];
|
|
33
|
+
readonly witness: readonly ChallengeHint[];
|
|
34
|
+
readonly tags: readonly string[];
|
|
35
|
+
readonly rawMetrics: DifficultyMetrics;
|
|
36
|
+
readonly score: number;
|
|
37
|
+
readonly marks: 1 | 2 | 3 | 4 | 5;
|
|
38
|
+
readonly gradingVersion: string;
|
|
39
|
+
readonly proofStatus: 'engine-witness-verified';
|
|
40
|
+
readonly reviewStatus: 'human-review-pending' | 'human-reviewed';
|
|
41
|
+
}
|
|
42
|
+
export interface CampaignManifest {
|
|
43
|
+
readonly count: number;
|
|
44
|
+
readonly candidatePoolCount: number;
|
|
45
|
+
readonly generationRevision: string;
|
|
46
|
+
readonly gradingVersion: string;
|
|
47
|
+
readonly category: string;
|
|
48
|
+
readonly curationPolicy: string;
|
|
49
|
+
readonly orderingPolicy: string;
|
|
50
|
+
readonly grading: Readonly<Record<string, unknown>>;
|
|
51
|
+
readonly sampleBudget: number;
|
|
52
|
+
readonly checksum: string;
|
|
53
|
+
readonly levels: readonly CampaignLevel[];
|
|
54
|
+
}
|
|
55
|
+
export interface TutorialStep {
|
|
56
|
+
readonly instruction: LocalizedText;
|
|
57
|
+
readonly action: string;
|
|
58
|
+
}
|
|
59
|
+
export interface TutorialDefinition {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly title: LocalizedText;
|
|
62
|
+
readonly objective: LocalizedText;
|
|
63
|
+
readonly setup: {
|
|
64
|
+
readonly board: readonly (Gem | null)[];
|
|
65
|
+
readonly queue: readonly Triplet[];
|
|
66
|
+
readonly goal: ChallengeGoal;
|
|
67
|
+
readonly witness: readonly ChallengeHint[];
|
|
68
|
+
};
|
|
69
|
+
readonly steps: readonly TutorialStep[];
|
|
70
|
+
readonly tags: readonly string[];
|
|
71
|
+
}
|
|
72
|
+
export type { Colour };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CampaignLevel, CampaignManifest, TutorialDefinition } from './content-types.js';
|
|
2
|
+
import type { GameState } from './types.js';
|
|
3
|
+
export declare const campaignManifest: CampaignManifest;
|
|
4
|
+
export declare const levelManifest: readonly CampaignLevel[];
|
|
5
|
+
export declare const tutorialManifest: readonly TutorialDefinition[];
|
|
6
|
+
/** Find a level by stable content ID or its current one-based display number. */
|
|
7
|
+
export declare function getLevel(id: string | number): CampaignLevel | undefined;
|
|
8
|
+
/** Construct a fresh validated challenge state for a stable level ID or display number. */
|
|
9
|
+
export declare function createLevel(id: string | number): GameState;
|
|
10
|
+
/** Find a lesson by its persistent ID. */
|
|
11
|
+
export declare function getTutorial(id: string): TutorialDefinition | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { contentData } from './content-data.js';
|
|
2
|
+
import { createChallenge } from './engine.js';
|
|
3
|
+
function deepFreeze(value) {
|
|
4
|
+
if (value && typeof value === 'object' && !Object.isFrozen(value)) {
|
|
5
|
+
Object.freeze(value);
|
|
6
|
+
for (const child of Object.values(value))
|
|
7
|
+
deepFreeze(child);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
export const campaignManifest = deepFreeze(contentData.campaign);
|
|
12
|
+
export const levelManifest = campaignManifest.levels;
|
|
13
|
+
export const tutorialManifest = deepFreeze(contentData.tutorials);
|
|
14
|
+
/** Find a level by stable content ID or its current one-based display number. */
|
|
15
|
+
export function getLevel(id) {
|
|
16
|
+
if (typeof id === 'number')
|
|
17
|
+
return Number.isInteger(id) ? levelManifest.find(level => level.number === id) : undefined;
|
|
18
|
+
return levelManifest.find(level => level.id === id);
|
|
19
|
+
}
|
|
20
|
+
/** Construct a fresh validated challenge state for a stable level ID or display number. */
|
|
21
|
+
export function createLevel(id) {
|
|
22
|
+
const level = getLevel(id);
|
|
23
|
+
if (!level)
|
|
24
|
+
throw new RangeError(`Unknown Falling Triplets level: ${String(id)}`);
|
|
25
|
+
return createChallenge({
|
|
26
|
+
seed: level.seed,
|
|
27
|
+
width: level.width,
|
|
28
|
+
height: level.height,
|
|
29
|
+
colourCount: level.colourCount,
|
|
30
|
+
board: level.board,
|
|
31
|
+
queue: level.queue,
|
|
32
|
+
goal: level.goal,
|
|
33
|
+
witness: level.witness
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Find a lesson by its persistent ID. */
|
|
37
|
+
export function getTutorial(id) {
|
|
38
|
+
return tutorialManifest.find(tutorial => tutorial.id === id);
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Action, ChallengeOptions, CreateOptions, GameState, Transition } from './types.js';
|
|
2
|
+
/** Returns the exact landing row for the current rigid triplet. */
|
|
3
|
+
export declare function landingY(state: GameState): number | null;
|
|
4
|
+
/** Creates a deterministic empty game with an active piece and three-piece preview. */
|
|
5
|
+
export declare function createGame(options?: CreateOptions): GameState;
|
|
6
|
+
/** Creates a challenge after validating its authored board, finite queue, goal, and witness. */
|
|
7
|
+
export declare function createChallenge(options: ChallengeOptions): GameState;
|
|
8
|
+
/** Applies and records one immutable action; rejected actions preserve state identity. */
|
|
9
|
+
export declare function applyAction(state: GameState, action: Action): Transition;
|
|
10
|
+
/** Advances fixed 60 Hz game ticks. Arcade timing is applied to the active piece. */
|
|
11
|
+
export declare function advanceTicks(state: GameState, ticks: number): Transition;
|
|
12
|
+
/** Lists the core actions currently available to the player. */
|
|
13
|
+
export declare function legalActions(state: GameState): readonly Action[];
|
|
14
|
+
/** Returns a plain status summary suitable for UI labels. */
|
|
15
|
+
export declare function statusOf(state: GameState): Readonly<{
|
|
16
|
+
phase: GameState['phase'];
|
|
17
|
+
score: number;
|
|
18
|
+
maxChain: number;
|
|
19
|
+
reason?: string;
|
|
20
|
+
}>;
|
|
21
|
+
/** Recreates the same authored mode, seed, and challenge configuration from its original setup. */
|
|
22
|
+
export declare function restartGame(state: GameState): GameState;
|
|
23
|
+
/** Encodes the authoritative settings, action recording, and derived checkpoint. */
|
|
24
|
+
export declare function encodeGame(state: GameState): string;
|
|
25
|
+
/** Replays and validates a bounded save, then verifies its checkpoint against the derived state. */
|
|
26
|
+
export declare function decodeGame(text: string): GameState;
|