@bilkobibitkov/threewinds-engine 0.1.1 → 0.1.2
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/README.md +1 -1
- package/dist/game.d.ts +5 -2
- package/dist/game.js +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/room.d.ts +1 -1
- package/dist/room.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,4 +30,4 @@ React or Node dependencies. Rules: `docs/RULES.md` in the source repo.
|
|
|
30
30
|
| `isOver`, `settle` | `settle` returns integer per-seat points summing to 0, none below −400: the win payment plus every kong payment (or the kong payments alone after a draw game), after R9.6. |
|
|
31
31
|
| `nextDealer(state)` | Extra: the dealer for the next hand under RULES.md R14.1. |
|
|
32
32
|
| `timeoutAction(state, seat)` | Extra: play for a timed-out human (R4.6): takes a legal win, otherwise passes or discards the tutor's pick. |
|
|
33
|
-
| `deadlineMs(state, seat)` | Extra (0.1.1): `CLAIM_WINDOW_MS`
|
|
33
|
+
| `deadlineMs(state, seat)` | Extra (added in 0.1.1; 0.1.2 sets the window to 10 s, `CLAIM_WINDOW_MS` 10000): `CLAIM_WINDOW_MS` for every seat while a claim window is open (R4.6), otherwise `undefined`, so the host's turn time applies (R3.5). It reads only the public phase, so a deadline never shows who holds a claim. |
|
package/dist/game.d.ts
CHANGED
|
@@ -135,8 +135,11 @@ export interface ClaimWindow {
|
|
|
135
135
|
/** Claims declared so far via apply(); the window closes once every other seat has declared. */
|
|
136
136
|
declared: Partial<Record<Seat, Action>>;
|
|
137
137
|
}
|
|
138
|
-
/**
|
|
139
|
-
|
|
138
|
+
/**
|
|
139
|
+
* R4.6: the online claim window (Bilko's `deadlineMs`). Every seat that has not declared gets this many
|
|
140
|
+
* ms in any claim window, then auto-passes. The Practice Table has no claim timer: it waits for the player.
|
|
141
|
+
*/
|
|
142
|
+
export declare const CLAIM_WINDOW_MS = 10000;
|
|
140
143
|
export interface GameState {
|
|
141
144
|
seed: number;
|
|
142
145
|
dealer: Seat;
|
package/dist/game.js
CHANGED
|
@@ -8,8 +8,11 @@ export const DEFAULT_RULES = {
|
|
|
8
8
|
return { valid: score.valid, deltas: score.valid ? settle(ctx, score, coWinners) : [0, 0, 0], score };
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* R4.6: the online claim window (Bilko's `deadlineMs`). Every seat that has not declared gets this many
|
|
13
|
+
* ms in any claim window, then auto-passes. The Practice Table has no claim timer: it waits for the player.
|
|
14
|
+
*/
|
|
15
|
+
export const CLAIM_WINDOW_MS = 10_000;
|
|
13
16
|
export class IllegalActionError extends Error {
|
|
14
17
|
seat;
|
|
15
18
|
action;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @threewinds/engine — platform-agnostic rules engine for Three Winds
|
|
3
3
|
* (Malaysian 3-player mahjong). Must never import DOM, React or React Native.
|
|
4
4
|
*/
|
|
5
|
-
export declare const ENGINE_VERSION = "0.1.
|
|
5
|
+
export declare const ENGINE_VERSION = "0.1.2";
|
|
6
6
|
export * from './tiles.js';
|
|
7
7
|
export * from './wall.js';
|
|
8
8
|
export * from './seed.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @threewinds/engine — platform-agnostic rules engine for Three Winds
|
|
3
3
|
* (Malaysian 3-player mahjong). Must never import DOM, React or React Native.
|
|
4
4
|
*/
|
|
5
|
-
export const ENGINE_VERSION = '0.1.
|
|
5
|
+
export const ENGINE_VERSION = '0.1.2';
|
|
6
6
|
export * from './tiles.js';
|
|
7
7
|
export * from './wall.js';
|
|
8
8
|
export * from './seed.js';
|
package/dist/room.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface ThreeWindsRoomModule extends RoomGameModule<RoomState> {
|
|
|
109
109
|
*/
|
|
110
110
|
timeoutAction(state: RoomState, seat: number): Action;
|
|
111
111
|
/**
|
|
112
|
-
* R4.6: CLAIM_WINDOW_MS (
|
|
112
|
+
* R4.6: CLAIM_WINDOW_MS (10 s) for every seat while a claim window is open (on a discard or a
|
|
113
113
|
* robbable added kong), else undefined: the host's own turn time. It reads only the public phase,
|
|
114
114
|
* so a seat's deadline never shows whether it holds a claim. Own turns keep the host's time
|
|
115
115
|
* although R3.5 has no own-turn timer offline: a stalled seat would hold up a live table.
|
package/dist/room.js
CHANGED
|
@@ -192,6 +192,7 @@ export const threeWindsRoomModule = {
|
|
|
192
192
|
{ type: 'discard', tileId: suggestDiscard(g, seat).tileId };
|
|
193
193
|
return cloneAction(pick);
|
|
194
194
|
},
|
|
195
|
+
/** R4.6: CLAIM_WINDOW_MS (10 s) while a claim window is open, else undefined (the host's turn time). */
|
|
195
196
|
deadlineMs(state, seat) {
|
|
196
197
|
if (!isSeat(seat))
|
|
197
198
|
throw new RangeError(`seat must be 0, 1 or 2, got ${String(seat)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bilkobibitkov/threewinds-engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Rules engine for Three Winds, Malaysian 3-player mahjong, plus its Bilko authoritative-room module (threeWindsRoomModule). Imported as @threewinds/engine via an alias.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|