@kradle/challenges-sdk 0.12.0 → 0.13.1
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 +67 -1
- package/LLM_README.md +285 -192
- package/MIGRATION-0.13.md +109 -0
- package/README.md +97 -88
- package/dist/engine.d.ts +8 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +17 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -16
- package/dist/index.js.map +1 -1
- package/dist/runtime/builder.d.ts +32 -0
- package/dist/runtime/builder.d.ts.map +1 -0
- package/dist/runtime/builder.js +357 -0
- package/dist/runtime/builder.js.map +1 -0
- package/dist/runtime/errors.d.ts +61 -0
- package/dist/runtime/errors.d.ts.map +1 -0
- package/dist/runtime/errors.js +71 -0
- package/dist/runtime/errors.js.map +1 -0
- package/dist/runtime/reducer.d.ts +205 -0
- package/dist/runtime/reducer.d.ts.map +1 -0
- package/dist/runtime/reducer.js +2025 -0
- package/dist/runtime/reducer.js.map +1 -0
- package/dist/runtime/rules.d.ts +29 -0
- package/dist/runtime/rules.d.ts.map +1 -0
- package/dist/runtime/rules.js +23 -0
- package/dist/runtime/rules.js.map +1 -0
- package/dist/runtime/sandbox.d.ts +2 -1
- package/dist/runtime/sandbox.d.ts.map +1 -1
- package/dist/runtime/sandbox.js +7 -4
- package/dist/runtime/sandbox.js.map +1 -1
- package/dist/runtime/time.d.ts +33 -0
- package/dist/runtime/time.d.ts.map +1 -0
- package/dist/runtime/time.js +53 -0
- package/dist/runtime/time.js.map +1 -0
- package/dist/runtime/types.d.ts +963 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +25 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/wire.d.ts +858 -0
- package/dist/runtime/wire.d.ts.map +1 -0
- package/dist/runtime/wire.js +28 -0
- package/dist/runtime/wire.js.map +1 -0
- package/dist/runtime/world.d.ts +58 -3
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +12 -0
- package/dist/runtime/world.js.map +1 -1
- package/dist/structures.d.ts +119 -0
- package/dist/structures.d.ts.map +1 -0
- package/dist/structures.js +279 -0
- package/dist/structures.js.map +1 -0
- package/dist/test/harness.d.ts +133 -29
- package/dist/test/harness.d.ts.map +1 -1
- package/dist/test/harness.js +191 -66
- package/dist/test/harness.js.map +1 -1
- package/dist/test/helpers.d.ts +3 -2
- package/dist/test/helpers.d.ts.map +1 -1
- package/dist/test/helpers.js +2 -2
- package/dist/test/helpers.js.map +1 -1
- package/package.json +30 -7
- package/dist/runtime/examples/capture-the-flag.d.ts +0 -33
- package/dist/runtime/examples/capture-the-flag.d.ts.map +0 -1
- package/dist/runtime/examples/capture-the-flag.js +0 -79
- package/dist/runtime/examples/capture-the-flag.js.map +0 -1
- package/dist/runtime/examples/climb.d.ts +0 -34
- package/dist/runtime/examples/climb.d.ts.map +0 -1
- package/dist/runtime/examples/climb.js +0 -54
- package/dist/runtime/examples/climb.js.map +0 -1
- package/dist/runtime/examples/four-bridges.d.ts +0 -107
- package/dist/runtime/examples/four-bridges.d.ts.map +0 -1
- package/dist/runtime/examples/four-bridges.js +0 -294
- package/dist/runtime/examples/four-bridges.js.map +0 -1
- package/dist/runtime/examples/herding.d.ts +0 -59
- package/dist/runtime/examples/herding.d.ts.map +0 -1
- package/dist/runtime/examples/herding.js +0 -181
- package/dist/runtime/examples/herding.js.map +0 -1
- package/dist/runtime/examples/skywars.d.ts +0 -116
- package/dist/runtime/examples/skywars.d.ts.map +0 -1
- package/dist/runtime/examples/skywars.js +0 -253
- package/dist/runtime/examples/skywars.js.map +0 -1
- package/dist/runtime/sdk.d.ts +0 -1038
- package/dist/runtime/sdk.d.ts.map +0 -1
- package/dist/runtime/sdk.js +0 -1271
- package/dist/runtime/sdk.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kradle/challenges-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"tag": "next"
|
|
6
6
|
},
|
|
@@ -19,23 +19,28 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"LLM_README.md",
|
|
21
21
|
"README.md",
|
|
22
|
-
"CHANGELOG.md"
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"MIGRATION-0.13.md"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "rm -rf dist && tsc
|
|
26
|
+
"build": "rm -rf dist && tsc",
|
|
26
27
|
"watch": "tsc --watch",
|
|
27
|
-
"test": "npm run build && node --test \"test/runtime/*.test.mjs\"",
|
|
28
|
+
"test": "npm run build && npm run check-types && node --test \"test/runtime/*.test.mjs\"",
|
|
28
29
|
"lint": "biome lint --fix --unsafe",
|
|
29
|
-
"check-docs": "node scripts/check-docs.mjs",
|
|
30
|
+
"check-docs": "node scripts/check-docs.mjs && node scripts/check-jsdoc.mjs && node scripts/check-examples.mjs",
|
|
30
31
|
"prepack": "npm run build && node scripts/stage-user-changelog.mjs",
|
|
31
32
|
"prepare": "npm run build",
|
|
32
|
-
"test:runtime": "node --test \"test/runtime/*.test.mjs\""
|
|
33
|
+
"test:runtime": "node --test \"test/runtime/*.test.mjs\"",
|
|
34
|
+
"check-types": "node node_modules/typescript/bin/tsc -p test/types/tsconfig.json && node node_modules/typescript5/bin/tsc -p test/types/tsconfig.json",
|
|
35
|
+
"check-jsdoc": "node scripts/check-jsdoc.mjs",
|
|
36
|
+
"check-examples": "node scripts/check-examples.mjs"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
39
|
"@biomejs/biome": "^2.3.4",
|
|
36
40
|
"@types/node": "^18.14.0",
|
|
37
41
|
"esbuild": "^0.27.2",
|
|
38
|
-
"typescript": "^6.0.3"
|
|
42
|
+
"typescript": "^6.0.3",
|
|
43
|
+
"typescript5": "npm:typescript@^5.9.3"
|
|
39
44
|
},
|
|
40
45
|
"engines": {
|
|
41
46
|
"node": ">=22.18.0"
|
|
@@ -45,10 +50,22 @@
|
|
|
45
50
|
"types": "./dist/index.d.ts",
|
|
46
51
|
"default": "./dist/index.js"
|
|
47
52
|
},
|
|
53
|
+
"./engine": {
|
|
54
|
+
"types": "./dist/engine.d.ts",
|
|
55
|
+
"default": "./dist/engine.js"
|
|
56
|
+
},
|
|
57
|
+
"./structures": {
|
|
58
|
+
"types": "./dist/structures.d.ts",
|
|
59
|
+
"default": "./dist/structures.js"
|
|
60
|
+
},
|
|
48
61
|
"./test": {
|
|
49
62
|
"types": "./dist/test/index.d.ts",
|
|
50
63
|
"default": "./dist/test/index.js"
|
|
51
64
|
},
|
|
65
|
+
"./sandbox": {
|
|
66
|
+
"types": "./dist/runtime/sandbox.d.ts",
|
|
67
|
+
"default": "./dist/runtime/sandbox.js"
|
|
68
|
+
},
|
|
52
69
|
"./runtime/sandbox": {
|
|
53
70
|
"types": "./dist/runtime/sandbox.d.ts",
|
|
54
71
|
"default": "./dist/runtime/sandbox.js"
|
|
@@ -57,9 +74,15 @@
|
|
|
57
74
|
},
|
|
58
75
|
"typesVersions": {
|
|
59
76
|
"*": {
|
|
77
|
+
"engine": [
|
|
78
|
+
"dist/engine.d.ts"
|
|
79
|
+
],
|
|
60
80
|
"test": [
|
|
61
81
|
"dist/test/index.d.ts"
|
|
62
82
|
],
|
|
83
|
+
"sandbox": [
|
|
84
|
+
"dist/runtime/sandbox.d.ts"
|
|
85
|
+
],
|
|
63
86
|
"runtime/sandbox": [
|
|
64
87
|
"dist/runtime/sandbox.d.ts"
|
|
65
88
|
]
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare const config: {
|
|
2
|
-
readonly name: "Capture the Flag";
|
|
3
|
-
readonly challengeConfig: {};
|
|
4
|
-
readonly roles: {
|
|
5
|
-
readonly capturer: {
|
|
6
|
-
readonly description: "capturer";
|
|
7
|
-
readonly minParticipants: 1;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const _default: import("../sdk.js").Challenge<{
|
|
12
|
-
readonly name: "Capture the Flag";
|
|
13
|
-
readonly challengeConfig: {};
|
|
14
|
-
readonly roles: {
|
|
15
|
-
readonly capturer: {
|
|
16
|
-
readonly description: "capturer";
|
|
17
|
-
readonly minParticipants: 1;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}, Record<string, never>, import("../sdk.js").ResolvePlayers<{
|
|
21
|
-
readonly name: "Capture the Flag";
|
|
22
|
-
readonly challengeConfig: {};
|
|
23
|
-
readonly roles: {
|
|
24
|
-
readonly capturer: {
|
|
25
|
-
readonly description: "capturer";
|
|
26
|
-
readonly minParticipants: 1;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}, {
|
|
30
|
-
returnedAt: number | null;
|
|
31
|
-
}, Record<never, never>>, "MAIN", never, never>;
|
|
32
|
-
export default _default;
|
|
33
|
-
//# sourceMappingURL=capture-the-flag.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capture-the-flag.d.ts","sourceRoot":"","sources":["../../../src/runtime/examples/capture-the-flag.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM;;;;;;;;;CAIiB,CAAC;;;;;;;;;;;;;;;;;;;;gBAeC,MAAM,GAAG,IAAI;;AAoBnD,wBAsCG"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.config = void 0;
|
|
4
|
-
// Capture the Flag on the runtime SDK. Same rules as team-kradle-challenges/challenges/capture-the-flag:
|
|
5
|
-
// break the red banner, carry it back, stand on blue wool at the blue base with it, within 1 minute.
|
|
6
|
-
// The two facts the datapack read with selectors every tick, "stands on blue wool" and
|
|
7
|
-
// "holds a red banner", are the block under the player in the block mirror and an
|
|
8
|
-
// inventory count from the engine. The rule is checked again whenever one of its
|
|
9
|
-
// inputs changes: the player's position, the inventory, or the floor itself.
|
|
10
|
-
const sdk_js_1 = require("../sdk.js");
|
|
11
|
-
exports.config = {
|
|
12
|
-
name: "Capture the Flag",
|
|
13
|
-
challengeConfig: {},
|
|
14
|
-
roles: { capturer: { description: "capturer", minParticipants: 1 } },
|
|
15
|
-
};
|
|
16
|
-
const BLUE_FLAG = { x: -495, y: 4, z: 2976 };
|
|
17
|
-
const RED_FLAG = { x: -495, y: 4, z: 2935 };
|
|
18
|
-
const BASE_SIZE = 2;
|
|
19
|
-
const RED_BANNER = "minecraft:red_banner";
|
|
20
|
-
const BLUE_WOOL = "minecraft:blue_wool";
|
|
21
|
-
// The floor is one block under the flag.
|
|
22
|
-
const floorOf = (c) => ({
|
|
23
|
-
from: { x: c.x - BASE_SIZE, y: c.y - 1, z: c.z - BASE_SIZE },
|
|
24
|
-
to: { x: c.x + BASE_SIZE, y: c.y - 1, z: c.z + BASE_SIZE },
|
|
25
|
-
});
|
|
26
|
-
const state = {
|
|
27
|
-
player: () => ({ returnedAt: null }),
|
|
28
|
-
};
|
|
29
|
-
/** The block under the player's feet is blue wool. Terrain the mirror does not know is not blue wool. */
|
|
30
|
-
function onBlueWool(g, p) {
|
|
31
|
-
if (!p.pos)
|
|
32
|
-
return false;
|
|
33
|
-
const below = { x: Math.floor(p.pos.x), y: Math.floor(p.pos.y) - 1, z: Math.floor(p.pos.z) };
|
|
34
|
-
return g.blockAt(below) === BLUE_WOOL;
|
|
35
|
-
}
|
|
36
|
-
function checkReturn(g, p) {
|
|
37
|
-
if (p.returnedAt !== null || !onBlueWool(g, p) || g.count(p, RED_BANNER) === 0)
|
|
38
|
-
return;
|
|
39
|
-
p.returnedAt = g.elapsed;
|
|
40
|
-
p.score = 1;
|
|
41
|
-
g.say(`${p.name} returned the red banner!`);
|
|
42
|
-
g.end();
|
|
43
|
-
}
|
|
44
|
-
exports.default = (0, sdk_js_1.defineChallenge)(exports.config, {
|
|
45
|
-
...state,
|
|
46
|
-
duration: (0, sdk_js_1.seconds)(60),
|
|
47
|
-
life: "respawn",
|
|
48
|
-
world: { time: "day" },
|
|
49
|
-
setup(g) {
|
|
50
|
-
g.killEntities();
|
|
51
|
-
const blue = floorOf(BLUE_FLAG);
|
|
52
|
-
g.fill(blue.from, blue.to, BLUE_WOOL);
|
|
53
|
-
g.setblock(BLUE_FLAG, "minecraft:blue_banner", '{Patterns:[{Pattern:"cs",Color:4},{Pattern:"bts",Color:11}]}');
|
|
54
|
-
const red = floorOf(RED_FLAG);
|
|
55
|
-
g.fill(red.from, red.to, "minecraft:red_wool");
|
|
56
|
-
g.setblock(RED_FLAG, RED_BANNER, '{Patterns:[{Pattern:"cs",Color:1},{Pattern:"bts",Color:14}]}');
|
|
57
|
-
},
|
|
58
|
-
start(g) {
|
|
59
|
-
for (const p of g.players) {
|
|
60
|
-
g.teleport(p, BLUE_FLAG);
|
|
61
|
-
g.give(p, "minecraft:iron_pickaxe", 1);
|
|
62
|
-
}
|
|
63
|
-
g.say("Capture the Flag challenge starting!");
|
|
64
|
-
},
|
|
65
|
-
at: [
|
|
66
|
-
{ at: "15s", run: (g) => g.say("Already 25% of the time has passed...") },
|
|
67
|
-
{ at: "30s", run: (g) => g.say("Half the time remaining! Hurry up!") },
|
|
68
|
-
],
|
|
69
|
-
on: {
|
|
70
|
-
move: (g, { player }) => checkReturn(g, player),
|
|
71
|
-
inventory: (g, { player }) => checkReturn(g, player),
|
|
72
|
-
blocksChanged(g) {
|
|
73
|
-
for (const p of g.players)
|
|
74
|
-
checkReturn(g, p);
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
winners: (g) => g.players.filter((p) => p.returnedAt !== null),
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=capture-the-flag.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capture-the-flag.js","sourceRoot":"","sources":["../../../src/runtime/examples/cap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;gBAAE,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;KACD;IAED,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC;CAC9D,CAAC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const config: {
|
|
2
|
-
readonly name: "Climb";
|
|
3
|
-
readonly challengeConfig: {};
|
|
4
|
-
readonly roles: {
|
|
5
|
-
readonly climber: {
|
|
6
|
-
readonly description: "climber";
|
|
7
|
-
readonly minParticipants: 2;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
declare const _default: import("../sdk.js").Challenge<{
|
|
12
|
-
readonly name: "Climb";
|
|
13
|
-
readonly challengeConfig: {};
|
|
14
|
-
readonly roles: {
|
|
15
|
-
readonly climber: {
|
|
16
|
-
readonly description: "climber";
|
|
17
|
-
readonly minParticipants: 2;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}, object, import("../sdk.js").ResolvePlayers<{
|
|
21
|
-
readonly name: "Climb";
|
|
22
|
-
readonly challengeConfig: {};
|
|
23
|
-
readonly roles: {
|
|
24
|
-
readonly climber: {
|
|
25
|
-
readonly description: "climber";
|
|
26
|
-
readonly minParticipants: 2;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}, {
|
|
30
|
-
maxY: number;
|
|
31
|
-
superClimber: boolean;
|
|
32
|
-
}, Record<never, never>>, string, string, string>;
|
|
33
|
-
export default _default;
|
|
34
|
-
//# sourceMappingURL=climb.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"climb.d.ts","sourceRoot":"","sources":["../../../src/runtime/examples/climb.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM;;;;;;;;;CAIiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAKrC,wBAqCG"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.config = void 0;
|
|
4
|
-
// Climb on the runtime SDK. Same rules as team-kradle-challenges/challenges/climb:
|
|
5
|
-
// 2 minutes, 64 cobblestone each, the highest point you reach is your score,
|
|
6
|
-
// one death eliminates you, the highest remaining climber wins.
|
|
7
|
-
const sdk_js_1 = require("../sdk.js");
|
|
8
|
-
exports.config = {
|
|
9
|
-
name: "Climb",
|
|
10
|
-
challengeConfig: {},
|
|
11
|
-
roles: { climber: { description: "climber", minParticipants: 2 } },
|
|
12
|
-
};
|
|
13
|
-
const FLOOR_Y = -60; // surface of the flat world
|
|
14
|
-
const SUPER_CLIMBER_HEIGHT = 100; // blocks above the floor
|
|
15
|
-
exports.default = (0, sdk_js_1.defineChallenge)(exports.config, {
|
|
16
|
-
duration: (0, sdk_js_1.minutes)(2),
|
|
17
|
-
life: "single",
|
|
18
|
-
world: { time: "day" },
|
|
19
|
-
player: () => ({ maxY: FLOOR_Y, superClimber: false }),
|
|
20
|
-
start(g) {
|
|
21
|
-
for (const p of g.players)
|
|
22
|
-
g.give(p, "minecraft:cobblestone", 64);
|
|
23
|
-
g.say("The Climb Challenge has begun!!");
|
|
24
|
-
},
|
|
25
|
-
on: {
|
|
26
|
-
// maxY is the highest point since the previous sample, so a jump apex between samples still counts.
|
|
27
|
-
move(g, { player: p, maxY }) {
|
|
28
|
-
const y = Math.floor(maxY);
|
|
29
|
-
if (p.eliminated || y <= p.maxY)
|
|
30
|
-
return;
|
|
31
|
-
p.maxY = y;
|
|
32
|
-
p.score = y - FLOOR_Y;
|
|
33
|
-
if (!p.superClimber && p.score >= SUPER_CLIMBER_HEIGHT) {
|
|
34
|
-
p.superClimber = true;
|
|
35
|
-
g.achievement(p, "super_climber");
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
damaged(g, { player, attacker, cause }) {
|
|
39
|
-
g.log(player, "I took damage!", { cause, y: player.maxY });
|
|
40
|
-
if (attacker)
|
|
41
|
-
g.log(attacker, "I did damage to a player!", { victim: player.name });
|
|
42
|
-
},
|
|
43
|
-
died(g, { player, killer }) {
|
|
44
|
-
if (!killer)
|
|
45
|
-
return;
|
|
46
|
-
g.say(`${player.name} was killed by a player`);
|
|
47
|
-
g.log(player, "I was killed by someone", { killer: killer.name });
|
|
48
|
-
g.log(killer, "I killed someone", { victim: player.name });
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
end: sdk_js_1.End.allEliminated,
|
|
52
|
-
winners: sdk_js_1.Win.topScore({ min: 1 }),
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=climb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"climb.js","sourceRoot":"","sources":["../../../src/runtime/examples/climb.ts"],"names":[],"mappings":";;;AAAA,mFAAmF;AACnF,6EAA6E;AAC7E,gEAAgE;AAChE,sCAAqF;AAExE,QAAA,MAAM,GAAG;IACrB,IAAI,EAAE,OAAO;IACb,eAAe,EAAE,EAAE;IACnB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,EAAE,EAAE;CAC/B,CAAC;AAErC,MAAM,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,4BAA4B;AACjD,MAAM,oBAAoB,GAAG,GAAG,CAAC,CAAC,yBAAyB;AAE3D,kBAAe,IAAA,wBAAe,EAAC,cAAM,EAAE;IACtC,QAAQ,EAAE,IAAA,gBAAO,EAAC,CAAC,CAAC;IACpB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IACtB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAEtD,KAAK,CAAC,CAAC;QACN,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BAAyB,CAAC,CAAC;YAC/C,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,yBAAyB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC;KACD;IAED,GAAG,EAAE,YAAG,CAAC,aAAa;IACtB,OAAO,EAAE,YAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;CACjC,CAAC,CAAC"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { type ContextOf } from "../sdk.js";
|
|
2
|
-
export declare const config: {
|
|
3
|
-
readonly name: "Four Bridges";
|
|
4
|
-
readonly challengeConfig: {
|
|
5
|
-
readonly votingOptions: {
|
|
6
|
-
readonly room: readonly ["blue", "red", "green", "yellow"];
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
readonly roles: {
|
|
10
|
-
readonly p1: {
|
|
11
|
-
readonly description: "Participant";
|
|
12
|
-
readonly minParticipants: 1;
|
|
13
|
-
};
|
|
14
|
-
readonly p2: {
|
|
15
|
-
readonly description: "Participant";
|
|
16
|
-
readonly minParticipants: 3;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
readonly endStates: {
|
|
20
|
-
readonly informed_dies: "p1 in death room";
|
|
21
|
-
readonly informed_no_commit: "p1 did not commit; a p2 did";
|
|
22
|
-
readonly informed_survives_no_death: "p1 in food room; nobody in death room";
|
|
23
|
-
readonly informed_survives_other_dies: "p1 in food room and at least one p2 in death room";
|
|
24
|
-
readonly no_resolution: "Nobody committed";
|
|
25
|
-
readonly error_no_death_room: "Setup error: the random death-room roll never happened";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export declare const COLORS: readonly ["BLUE", "RED", "GREEN", "YELLOW"];
|
|
29
|
-
export type Color = (typeof COLORS)[number];
|
|
30
|
-
export type BridgeId = 1 | 2 | 3 | 4;
|
|
31
|
-
export declare const DISCUSSION_TICKS: import("../sdk.js").Ticks;
|
|
32
|
-
export declare const COMMIT_TICKS: import("../sdk.js").Ticks;
|
|
33
|
-
export declare const RESOLUTION_TICKS: import("../sdk.js").Ticks;
|
|
34
|
-
interface Bridge {
|
|
35
|
-
id: BridgeId;
|
|
36
|
-
label: Color;
|
|
37
|
-
axis: "x" | "z";
|
|
38
|
-
sign: 1 | -1;
|
|
39
|
-
}
|
|
40
|
-
export declare const BRIDGES: Bridge[];
|
|
41
|
-
declare const state: {
|
|
42
|
-
game: () => {
|
|
43
|
-
deathBridge: 0 | BridgeId;
|
|
44
|
-
};
|
|
45
|
-
player: () => {
|
|
46
|
-
choice: 0 | BridgeId;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
type G = ContextOf<typeof config, typeof state>;
|
|
50
|
-
export declare function classify(g: G): keyof typeof config.endStates;
|
|
51
|
-
declare const _default: import("../sdk.js").Challenge<{
|
|
52
|
-
readonly name: "Four Bridges";
|
|
53
|
-
readonly challengeConfig: {
|
|
54
|
-
readonly votingOptions: {
|
|
55
|
-
readonly room: readonly ["blue", "red", "green", "yellow"];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
readonly roles: {
|
|
59
|
-
readonly p1: {
|
|
60
|
-
readonly description: "Participant";
|
|
61
|
-
readonly minParticipants: 1;
|
|
62
|
-
};
|
|
63
|
-
readonly p2: {
|
|
64
|
-
readonly description: "Participant";
|
|
65
|
-
readonly minParticipants: 3;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
readonly endStates: {
|
|
69
|
-
readonly informed_dies: "p1 in death room";
|
|
70
|
-
readonly informed_no_commit: "p1 did not commit; a p2 did";
|
|
71
|
-
readonly informed_survives_no_death: "p1 in food room; nobody in death room";
|
|
72
|
-
readonly informed_survives_other_dies: "p1 in food room and at least one p2 in death room";
|
|
73
|
-
readonly no_resolution: "Nobody committed";
|
|
74
|
-
readonly error_no_death_room: "Setup error: the random death-room roll never happened";
|
|
75
|
-
};
|
|
76
|
-
}, {
|
|
77
|
-
deathBridge: 0 | BridgeId;
|
|
78
|
-
}, import("../sdk.js").ResolvePlayers<{
|
|
79
|
-
readonly name: "Four Bridges";
|
|
80
|
-
readonly challengeConfig: {
|
|
81
|
-
readonly votingOptions: {
|
|
82
|
-
readonly room: readonly ["blue", "red", "green", "yellow"];
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
readonly roles: {
|
|
86
|
-
readonly p1: {
|
|
87
|
-
readonly description: "Participant";
|
|
88
|
-
readonly minParticipants: 1;
|
|
89
|
-
};
|
|
90
|
-
readonly p2: {
|
|
91
|
-
readonly description: "Participant";
|
|
92
|
-
readonly minParticipants: 3;
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
readonly endStates: {
|
|
96
|
-
readonly informed_dies: "p1 in death room";
|
|
97
|
-
readonly informed_no_commit: "p1 did not commit; a p2 did";
|
|
98
|
-
readonly informed_survives_no_death: "p1 in food room; nobody in death room";
|
|
99
|
-
readonly informed_survives_other_dies: "p1 in food room and at least one p2 in death room";
|
|
100
|
-
readonly no_resolution: "Nobody committed";
|
|
101
|
-
readonly error_no_death_room: "Setup error: the random death-room roll never happened";
|
|
102
|
-
};
|
|
103
|
-
}, {
|
|
104
|
-
choice: 0 | BridgeId;
|
|
105
|
-
}, Record<never, never>>, string, never, never>;
|
|
106
|
-
export default _default;
|
|
107
|
-
//# sourceMappingURL=four-bridges.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"four-bridges.d.ts","sourceRoot":"","sources":["../../../src/runtime/examples/four-bridges.ts"],"names":[],"mappings":"AAGA,OAAO,EAEN,KAAK,SAAS,EAMd,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAiBiB,CAAC;AAIrC,eAAO,MAAM,MAAM,6CAA8C,CAAC;AAClE,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAGrC,eAAO,MAAM,gBAAgB,2BAAc,CAAC;AAC5C,eAAO,MAAM,YAAY,2BAAc,CAAC;AACxC,eAAO,MAAM,gBAAgB,2BAAc,CAAC;AAa5C,UAAU,MAAM;IACf,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChB,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACb;AAED,eAAO,MAAM,OAAO,EAAE,MAAM,EAK3B,CAAC;AAqBF,QAAA,MAAM,KAAK;;qBACuB,CAAC,GAAG,QAAQ;;;gBACf,CAAC,GAAG,QAAQ;;CAC1C,CAAC;AACF,KAAK,CAAC,GAAG,SAAS,CAAC,OAAO,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC;AA0IhD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,OAAO,MAAM,CAAC,SAAS,CAW5D;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAxJiC,CAAC,GAAG,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;YACf,CAAC,GAAG,QAAQ;;AA2J3C,wBAuFG"}
|