@johnmorrisdotca/kumimoji 1.2.1 → 1.3.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 +37 -1
- package/CONTRIBUTING.md +81 -44
- package/README.md +478 -327
- package/dist/check.d.ts +26 -1
- package/dist/check.js +26 -1
- package/dist/computer.types.d.ts +24 -2
- package/dist/computerPlay.d.ts +45 -2
- package/dist/computerPlay.js +45 -2
- package/dist/computerTurn.d.ts +42 -3
- package/dist/computerTurn.js +42 -3
- package/dist/daily.d.ts +22 -2
- package/dist/daily.js +22 -2
- package/dist/element-define.d.ts +1 -1
- package/dist/element-define.js +3 -13
- package/dist/element.d.ts +85 -4
- package/dist/element.js +176 -45
- package/dist/embed-day.d.ts +4 -0
- package/dist/embed-day.js +23 -0
- package/dist/export.d.ts +123 -6
- package/dist/export.js +91 -4
- package/dist/generate.d.ts +14 -0
- package/dist/generate.js +14 -0
- package/dist/grid.d.ts +181 -10
- package/dist/grid.js +122 -7
- package/dist/help.d.ts +36 -3
- package/dist/help.js +36 -3
- package/dist/judge.d.ts +14 -0
- package/dist/judge.js +14 -0
- package/dist/kana.d.ts +23 -1
- package/dist/kana.js +23 -1
- package/dist/kumimoji.types.d.ts +70 -5
- package/dist/party.d.ts +268 -14
- package/dist/party.js +268 -14
- package/dist/party.types.d.ts +50 -2
- package/dist/partyKept.d.ts +74 -4
- package/dist/partyKept.js +74 -4
- package/dist/partySeats.d.ts +92 -6
- package/dist/partySeats.js +72 -4
- package/dist/partyTurns.d.ts +171 -5
- package/dist/partyTurns.js +171 -5
- package/dist/placement.d.ts +50 -2
- package/dist/placement.js +30 -0
- package/dist/play.d.ts +247 -15
- package/dist/play.js +237 -15
- package/dist/random.d.ts +34 -3
- package/dist/random.js +23 -2
- package/dist/react.d.ts +42 -4
- package/dist/react.js +22 -5
- package/dist/showcase.d.ts +83 -7
- package/dist/showcase.js +49 -4
- package/dist/strings.d.ts +54 -5
- package/dist/strings.js +34 -3
- package/dist/tableView.d.ts +151 -8
- package/dist/tableView.js +129 -6
- package/dist/tileFace.d.ts +59 -5
- package/dist/tileFace.js +48 -4
- package/dist/tileFamily.d.ts +9 -0
- package/dist/tileFamily.js +9 -0
- package/dist/tileWords.d.ts +93 -6
- package/dist/tileWords.js +83 -6
- package/dist/tileWordsModule.d.ts +11 -1
- package/dist/tileWordsModule.js +11 -1
- package/dist/tiles.constants.d.ts +99 -5
- package/dist/tiles.constants.js +99 -5
- package/dist/turn.d.ts +82 -4
- package/dist/turn.js +82 -4
- package/dist/ui/board.d.ts +60 -5
- package/dist/ui/board.js +28 -2
- package/dist/ui/mount.d.ts +41 -2
- package/dist/ui/mount.js +38 -1
- package/dist/ui/style.d.ts +6 -1
- package/dist/ui/style.js +6 -0
- package/dist/version.d.ts +9 -2
- package/dist/version.js +9 -2
- package/dist/wilds.d.ts +22 -1
- package/dist/wilds.js +22 -1
- package/package.json +66 -57
package/dist/kana.js
CHANGED
|
@@ -12,12 +12,28 @@
|
|
|
12
12
|
* form: は then ん is はん, ばん and ぱん at once. The word list is stored
|
|
13
13
|
* already read this way (`scripts/word-lists-ja.mjs` folds it with the same
|
|
14
14
|
* table), so checking a line is one lookup.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { BASE_KANA } from "@johnmorrisdotca/kumimoji";
|
|
19
|
+
* console.log(BASE_KANA);
|
|
20
|
+
* ```
|
|
15
21
|
*/
|
|
16
22
|
export const BASE_KANA = "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわん";
|
|
17
23
|
const SMALL_AND_OLD = {
|
|
18
24
|
ぁ: "あ", ぃ: "い", ぅ: "う", ぇ: "え", ぉ: "お", っ: "つ", ゃ: "や", ゅ: "ゆ", ょ: "よ", ゎ: "わ", ゕ: "か", ゖ: "け", を: "お", ゐ: "い", ゑ: "え",
|
|
19
25
|
};
|
|
20
|
-
/** The tile a kana is played with, or null for anything that is not hiragana (ー, katakana, a letter).
|
|
26
|
+
/** The tile a kana is played with, or null for anything that is not hiragana (ー, katakana, a letter).
|
|
27
|
+
*
|
|
28
|
+
* @param kana - The hiragana reading to map to a base tile.
|
|
29
|
+
* @returns The tile a kana is played with, or null for anything that is not hiragana (ー, katakana, a letter).
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { tileKana } from "@johnmorrisdotca/kumimoji";
|
|
33
|
+
*
|
|
34
|
+
* console.log(tileKana("が"));
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
21
37
|
export function tileKana(kana) {
|
|
22
38
|
const bare = kana.normalize("NFD").replace(/[゙゚]/gu, "").normalize("NFC");
|
|
23
39
|
const base = SMALL_AND_OLD[bare] ?? bare;
|
|
@@ -28,6 +44,12 @@ export function tileKana(kana) {
|
|
|
28
44
|
* (John, 2026-09-28: "the tiles like Yu can show the regular and small version
|
|
29
45
|
* in that tile to show its versatility"). Only the forms a player reaches for;
|
|
30
46
|
* the rare ones (ぁ, ゎ, ゔ) still play, and the rules say so.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { CORNER_FORMS } from "@johnmorrisdotca/kumimoji";
|
|
51
|
+
* console.log(CORNER_FORMS);
|
|
52
|
+
* ```
|
|
31
53
|
*/
|
|
32
54
|
export const CORNER_FORMS = {
|
|
33
55
|
か: "が", き: "ぎ", く: "ぐ", け: "げ", こ: "ご",
|
package/dist/kumimoji.types.d.ts
CHANGED
|
@@ -1,16 +1,60 @@
|
|
|
1
|
-
/** How much of the set a game's bag holds: a short game, half the set, or all of it.
|
|
1
|
+
/** How much of the set a game's bag holds: a short game, half the set, or all of it.
|
|
2
|
+
*
|
|
3
|
+
* @example
|
|
4
|
+
* ```ts
|
|
5
|
+
* import type { KumimojiLength } from "@johnmorrisdotca/kumimoji";
|
|
6
|
+
*
|
|
7
|
+
* const value: KumimojiLength = "short";
|
|
8
|
+
* console.log(value);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
2
11
|
export type KumimojiLength = "short" | "medium" | "full";
|
|
3
|
-
/** How many of the bag's tiles are wild: easy the most, hard none (`KUMIMOJI_WILDS`).
|
|
12
|
+
/** How many of the bag's tiles are wild: easy the most, hard none (`KUMIMOJI_WILDS`).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import type { KumimojiLevel } from "@johnmorrisdotca/kumimoji";
|
|
17
|
+
*
|
|
18
|
+
* const value: KumimojiLevel = "hard";
|
|
19
|
+
* console.log(value);
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
4
22
|
export type KumimojiLevel = "easy" | "medium" | "hard";
|
|
5
|
-
/** The language of the tiles and of the word list they are judged by.
|
|
23
|
+
/** The language of the tiles and of the word list they are judged by.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import type { KumimojiLanguage } from "@johnmorrisdotca/kumimoji";
|
|
28
|
+
*
|
|
29
|
+
* const value: KumimojiLanguage = "japanese";
|
|
30
|
+
* console.log(value);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
6
33
|
export type KumimojiLanguage = "english" | "japanese";
|
|
7
|
-
/** How far the player has turned the table to look at it: quarter turns clockwise, 0 to 3. The view alone; the grid never turns.
|
|
34
|
+
/** How far the player has turned the table to look at it: quarter turns clockwise, 0 to 3. The view alone; the grid never turns.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import type { Turn } from "@johnmorrisdotca/kumimoji";
|
|
39
|
+
*
|
|
40
|
+
* const value: Turn = 1;
|
|
41
|
+
* console.log(value);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
8
44
|
export type Turn = 0 | 1 | 2 | 3;
|
|
9
45
|
/**
|
|
10
46
|
* WHAT A KUMIMOJI WAS SET UP AS, beyond its hand and level: the choices that
|
|
11
47
|
* make one game a different game from another at the same seed, carried
|
|
12
48
|
* together wherever a game is made, checked, kept or raced. Each is optional,
|
|
13
49
|
* and its absence is the default: Short, English, one set, no diagonals.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import type { KumimojiOptions } from "@johnmorrisdotca/kumimoji";
|
|
54
|
+
*
|
|
55
|
+
* const value: KumimojiOptions = {language:"english",diagonals:false};
|
|
56
|
+
* console.log(value);
|
|
57
|
+
* ```
|
|
14
58
|
*/
|
|
15
59
|
export type KumimojiOptions = {
|
|
16
60
|
gameLength?: KumimojiLength;
|
|
@@ -24,7 +68,16 @@ export type KumimojiOptions = {
|
|
|
24
68
|
*/
|
|
25
69
|
diagonals?: boolean;
|
|
26
70
|
};
|
|
27
|
-
/** The answer to "does this grid finish the game?": yes, or no and why.
|
|
71
|
+
/** The answer to "does this grid finish the game?": yes, or no and why.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* import type { KumimojiCheck } from "@johnmorrisdotca/kumimoji";
|
|
76
|
+
*
|
|
77
|
+
* const value: KumimojiCheck = {ok:false,reason:"Not a finished grid"};
|
|
78
|
+
* console.log(value);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
28
81
|
export type KumimojiCheck = {
|
|
29
82
|
ok: true;
|
|
30
83
|
} | {
|
|
@@ -35,6 +88,18 @@ export type KumimojiCheck = {
|
|
|
35
88
|
* A GAME DEALT (`generateKumimoji`): the bag, in the order its tiles come out,
|
|
36
89
|
* as one string of tile codes (`*` a wild), and one finished grid of those
|
|
37
90
|
* tiles that proves the bag can be finished, never shown to the player.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { generateKumimoji } from "@johnmorrisdotca/kumimoji";
|
|
95
|
+
* import type { KumimojiDeal } from "@johnmorrisdotca/kumimoji";
|
|
96
|
+
* import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
|
|
97
|
+
*
|
|
98
|
+
* await loadTileWordsFromModule("english");
|
|
99
|
+
* const dealt = generateKumimoji(3,"hard",44);
|
|
100
|
+
* const value: KumimojiDeal = dealt;
|
|
101
|
+
* console.log(value);
|
|
102
|
+
* ```
|
|
38
103
|
*/
|
|
39
104
|
export type KumimojiDeal = {
|
|
40
105
|
kind: "kumimoji";
|
package/dist/party.d.ts
CHANGED
|
@@ -17,11 +17,44 @@ import { type TilePlay } from "./play.ts";
|
|
|
17
17
|
* everybody — and in `partyTurns.ts`: Done, going out, the last round,
|
|
18
18
|
* resigning and who won. Pure, like every rule here: each returns a new game.
|
|
19
19
|
*/
|
|
20
|
-
/** The tiles a bag must hold for this many players: a hand each and one round of draws.
|
|
20
|
+
/** The tiles a bag must hold for this many players: a hand each and one round of draws.
|
|
21
|
+
*
|
|
22
|
+
* @param players - The requested player count or current player rows.
|
|
23
|
+
* @param hand - The hand size or tile codes, as declared by the function signature.
|
|
24
|
+
* @returns The tiles a bag must hold for this many players: a hand each and one round of draws.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { partyTilesNeeded } from "@johnmorrisdotca/kumimoji";
|
|
28
|
+
*
|
|
29
|
+
* console.log(partyTilesNeeded(2,3));
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
21
32
|
export declare function partyTilesNeeded(players: number, hand: number): number;
|
|
22
|
-
/** Whether a bag of this many tiles can be played by this many: one player can play any bag.
|
|
33
|
+
/** Whether a bag of this many tiles can be played by this many: one player can play any bag.
|
|
34
|
+
*
|
|
35
|
+
* @param players - The requested player count or current player rows.
|
|
36
|
+
* @param hand - The hand size or tile codes, as declared by the function signature.
|
|
37
|
+
* @param tiles - The map from row,column square names to internal tile codes.
|
|
38
|
+
* @returns Whether a bag of this many tiles can be played by this many: one player can play any bag.
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { partyFits } from "@johnmorrisdotca/kumimoji";
|
|
42
|
+
*
|
|
43
|
+
* console.log(partyFits(2,3,12));
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
23
46
|
export declare function partyFits(players: number, hand: number, tiles: number): boolean;
|
|
24
|
-
/** A players count from the address, or 1 (the solo game) for anything that is not two to eight.
|
|
47
|
+
/** A players count from the address, or 1 (the solo game) for anything that is not two to eight.
|
|
48
|
+
*
|
|
49
|
+
* @param value - The unknown setup value to interpret.
|
|
50
|
+
* @returns A players count from the address, or 1 (the solo game) for anything that is not two to eight.
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { partyPlayersAsked } from "@johnmorrisdotca/kumimoji";
|
|
54
|
+
*
|
|
55
|
+
* console.log(partyPlayersAsked("3"));
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
25
58
|
export declare function partyPlayersAsked(value: unknown): number;
|
|
26
59
|
/**
|
|
27
60
|
* The game length a set-up plays at: the one chosen where the bag holds this
|
|
@@ -29,25 +62,125 @@ export declare function partyPlayersAsked(value: unknown): number;
|
|
|
29
62
|
* players comes back when there are fewer again. A Full bag of one set is 144
|
|
30
63
|
* tiles, and eight Classic hands with a round of draws are 96, so there is
|
|
31
64
|
* always one.
|
|
65
|
+
*
|
|
66
|
+
* @param players - The requested player count or current player rows.
|
|
67
|
+
* @param hand - The hand size or tile codes, as declared by the function signature.
|
|
68
|
+
* @param chosen - The selected game length.
|
|
69
|
+
* @param doubleSet - Whether to use two English tile sets.
|
|
70
|
+
* @returns The game length a set-up plays at: the one chosen where the bag holds this many players, else the shortest that does, so a choice made for fewer players comes back when there are fewer again. A Full bag of one set is 144 tiles, and eight Classic hands with a round of draws are 96, so there is always one.
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { partyLength } from "@johnmorrisdotca/kumimoji";
|
|
74
|
+
*
|
|
75
|
+
* console.log(partyLength(8,11,"short",false));
|
|
76
|
+
* ```
|
|
32
77
|
*/
|
|
33
78
|
export declare function partyLength(players: number, hand: number, chosen: KumimojiLength, doubleSet: boolean): KumimojiLength;
|
|
34
79
|
/**
|
|
35
80
|
* The deal: each player the next hand from the bag in turn, player one first,
|
|
36
81
|
* and every table empty. A seat is a name, or a name and whether a computer
|
|
37
82
|
* plays it; a computer is named "Computer 1", "Computer 2"… in seat order.
|
|
83
|
+
*
|
|
84
|
+
* @param settings - The native party setup settings.
|
|
85
|
+
* @param bag - The original bag in draw order.
|
|
86
|
+
* @param seats - Local player names and optional computer flags.
|
|
87
|
+
* @returns The deal: each player the next hand from the bag in turn, player one first, and every table empty. A seat is a name, or a name and whether a computer plays it; a computer is named "Computer 1", "Computer 2"… in seat order.
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* import { startParty } from "@johnmorrisdotca/kumimoji";
|
|
91
|
+
*
|
|
92
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
93
|
+
* const bag = "catdogsun";
|
|
94
|
+
* console.log(startParty(settings,bag,["Seat 1","Seat 2"]).players.length);
|
|
95
|
+
* ```
|
|
38
96
|
*/
|
|
39
97
|
export declare function startParty(settings: PartySettings, bag: string, seats: readonly (string | PartySeat)[]): PartyGame;
|
|
40
|
-
/** The name a new computer takes: "Computer" and the lowest number no player at the table already goes by.
|
|
98
|
+
/** The name a new computer takes: "Computer" and the lowest number no player at the table already goes by.
|
|
99
|
+
*
|
|
100
|
+
* @param players - The requested player count or current player rows.
|
|
101
|
+
* @returns The name a new computer takes: "Computer" and the lowest number no player at the table already goes by.
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import { computerName, startParty } from "@johnmorrisdotca/kumimoji";
|
|
105
|
+
*
|
|
106
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
107
|
+
* const bag = "catdogsun";
|
|
108
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
109
|
+
* console.log(computerName(game.players));
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
41
112
|
export declare function computerName(players: readonly PartyPlayer[]): string;
|
|
42
|
-
/** Whether a computer plays this seat.
|
|
113
|
+
/** Whether a computer plays this seat.
|
|
114
|
+
*
|
|
115
|
+
* @param game - The current immutable shared-bag party game.
|
|
116
|
+
* @param at - The word offset, seat index or date specified by this signature.
|
|
117
|
+
* @returns Whether a computer plays this seat.
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { isComputer, startParty } from "@johnmorrisdotca/kumimoji";
|
|
121
|
+
*
|
|
122
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
123
|
+
* const bag = "catdogsun";
|
|
124
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
125
|
+
* console.log(isComputer(game,0));
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
43
128
|
export declare function isComputer(game: PartyGame, at: number): boolean;
|
|
44
|
-
/** A table's tiles as one string in order, wherever they stand: what a turn compares to see whether anything was laid or lifted.
|
|
129
|
+
/** A table's tiles as one string in order, wherever they stand: what a turn compares to see whether anything was laid or lifted.
|
|
130
|
+
*
|
|
131
|
+
* @param tiles - The map from row,column square names to internal tile codes.
|
|
132
|
+
* @returns A table's tiles as one string in order, wherever they stand: what a turn compares to see whether anything was laid or lifted.
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* import { tableTally } from "@johnmorrisdotca/kumimoji";
|
|
136
|
+
*
|
|
137
|
+
* const tiles = new Map([["0,0","c"],["0,1","a"],["0,2","t"]]);
|
|
138
|
+
* console.log(tableTally(tiles));
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
45
141
|
export declare function tableTally(tiles: Tiles): string;
|
|
46
|
-
/** A name as kept: trimmed, one line, and no longer than a line holds.
|
|
142
|
+
/** A name as kept: trimmed, one line, and no longer than a line holds.
|
|
143
|
+
*
|
|
144
|
+
* @param name - The local player name to tidy.
|
|
145
|
+
* @returns A name as kept: trimmed, one line, and no longer than a line holds.
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* import { tidyName } from "@johnmorrisdotca/kumimoji";
|
|
149
|
+
*
|
|
150
|
+
* console.log(tidyName(" Seat 1 "));
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
47
153
|
export declare function tidyName(name: string): string;
|
|
48
|
-
/** What a player is called: their name, or "Player 2".
|
|
154
|
+
/** What a player is called: their name, or "Player 2".
|
|
155
|
+
*
|
|
156
|
+
* @param game - The current immutable shared-bag party game.
|
|
157
|
+
* @param at - The word offset, seat index or date specified by this signature.
|
|
158
|
+
* @returns What a player is called: their name, or "Player 2".
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { nameOf, startParty } from "@johnmorrisdotca/kumimoji";
|
|
162
|
+
*
|
|
163
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
164
|
+
* const bag = "catdogsun";
|
|
165
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
166
|
+
* console.log(nameOf(game,0));
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
49
169
|
export declare function nameOf(game: PartyGame, at: number): string;
|
|
50
|
-
/** The player whose turn it is, as the solo game's moves take a game: the shared bag, and their own hand and table.
|
|
170
|
+
/** The player whose turn it is, as the solo game's moves take a game: the shared bag, and their own hand and table.
|
|
171
|
+
*
|
|
172
|
+
* @param game - The current immutable shared-bag party game.
|
|
173
|
+
* @returns The player whose turn it is, as the solo game's moves take a game: the shared bag, and their own hand and table.
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { seatPlay, startParty } from "@johnmorrisdotca/kumimoji";
|
|
177
|
+
*
|
|
178
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
179
|
+
* const bag = "catdogsun";
|
|
180
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
181
|
+
* console.log(seatPlay(game));
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
51
184
|
export declare function seatPlay(game: PartyGame): TilePlay;
|
|
52
185
|
/**
|
|
53
186
|
* ONE TRADE A TURN. John, 2026-09-29, after a player traded over and over and
|
|
@@ -56,26 +189,120 @@ export declare function seatPlay(game: PartyGame): TilePlay;
|
|
|
56
189
|
* takes three, so trading without end lets one player take the bag from the
|
|
57
190
|
* others. After a trade the player may still lay, lift and draw, and press
|
|
58
191
|
* Done; the next trade is on their next turn.
|
|
192
|
+
*
|
|
193
|
+
* @param game - The current immutable shared-bag party game.
|
|
194
|
+
* @returns ONE TRADE A TURN. John, 2026-09-29, after a player traded over and over and built up a hand: "if they swap tiles … give them a chance to lay some tiles but cannot ask for another swap until next turn." A trade gives one tile and takes three, so trading without end lets one player take the bag from the others. After a trade the player may still lay, lift and draw, and press Done; the next trade is on their next turn.
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* import { mayTradeThisTurn, startParty } from "@johnmorrisdotca/kumimoji";
|
|
198
|
+
*
|
|
199
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
200
|
+
* const bag = "catdogsun";
|
|
201
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
202
|
+
* console.log(mayTradeThisTurn(game));
|
|
203
|
+
* ```
|
|
59
204
|
*/
|
|
60
205
|
export declare function mayTradeThisTurn(game: PartyGame): boolean;
|
|
61
|
-
/** A move made on `seatPlay` put back: the bag as it left it, and the hand and table to the player whose turn it is. A second trade in one turn is refused, the game given back as it was.
|
|
206
|
+
/** A move made on `seatPlay` put back: the bag as it left it, and the hand and table to the player whose turn it is. A second trade in one turn is refused, the game given back as it was.
|
|
207
|
+
*
|
|
208
|
+
* @param game - The current immutable shared-bag party game.
|
|
209
|
+
* @param play - The current immutable solo-game progress.
|
|
210
|
+
* @returns A move made on `seatPlay` put back: the bag as it left it, and the hand and table to the player whose turn it is. A second trade in one turn is refused, the game given back as it was.
|
|
211
|
+
* @example
|
|
212
|
+
* ```ts
|
|
213
|
+
* import { seatPlay, startParty, withSeatPlay } from "@johnmorrisdotca/kumimoji";
|
|
214
|
+
*
|
|
215
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
216
|
+
* const bag = "catdogsun";
|
|
217
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
218
|
+
* console.log(withSeatPlay(game,seatPlay(game)).taken);
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
62
221
|
export declare function withSeatPlay(game: PartyGame, play: TilePlay): PartyGame;
|
|
63
|
-
/** Tiles still in the shared bag.
|
|
222
|
+
/** Tiles still in the shared bag.
|
|
223
|
+
*
|
|
224
|
+
* @param game - The current immutable shared-bag party game.
|
|
225
|
+
* @returns Tiles still in the shared bag.
|
|
226
|
+
* @example
|
|
227
|
+
* ```ts
|
|
228
|
+
* import { partyTilesLeft, startParty } from "@johnmorrisdotca/kumimoji";
|
|
229
|
+
*
|
|
230
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
231
|
+
* const bag = "catdogsun";
|
|
232
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
233
|
+
* console.log(partyTilesLeft(game));
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
64
236
|
export declare function partyTilesLeft(game: PartyGame): number;
|
|
65
|
-
/** The players still in — not resigned — by place, in turn order. Somebody who went out is still in until the game ends.
|
|
237
|
+
/** The players still in — not resigned — by place, in turn order. Somebody who went out is still in until the game ends.
|
|
238
|
+
*
|
|
239
|
+
* @param game - The current immutable shared-bag party game.
|
|
240
|
+
* @returns The players still in — not resigned — by place, in turn order. Somebody who went out is still in until the game ends.
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { startParty, stillIn } from "@johnmorrisdotca/kumimoji";
|
|
244
|
+
*
|
|
245
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
246
|
+
* const bag = "catdogsun";
|
|
247
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
248
|
+
* console.log(stillIn(game));
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
66
251
|
export declare function stillIn(game: PartyGame): number[];
|
|
67
|
-
/** The next player still in after `from`, round the table; `from` itself when nobody else is.
|
|
252
|
+
/** The next player still in after `from`, round the table; `from` itself when nobody else is.
|
|
253
|
+
*
|
|
254
|
+
* @param game - The current immutable shared-bag party game.
|
|
255
|
+
* @param from - The source square or seat index.
|
|
256
|
+
* @returns The next player still in after `from`, round the table; `from` itself when nobody else is.
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* import { nextIn, startParty } from "@johnmorrisdotca/kumimoji";
|
|
260
|
+
*
|
|
261
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
262
|
+
* const bag = "catdogsun";
|
|
263
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
264
|
+
* console.log(nextIn(game,0));
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
68
267
|
export declare function nextIn(game: PartyGame, from: number): number;
|
|
69
268
|
/**
|
|
70
269
|
* Whether Draw may be pressed: the hand of the player whose turn it is used,
|
|
71
270
|
* their grid sound, and a tile in the bag for every player still in. Never in
|
|
72
271
|
* the last round, when the bag already holds fewer than that.
|
|
272
|
+
*
|
|
273
|
+
* @param game - The current immutable shared-bag party game.
|
|
274
|
+
* @param verdict - The native word and connectivity verdict for this grid.
|
|
275
|
+
* @returns Whether Draw may be pressed: the hand of the player whose turn it is used, their grid sound, and a tile in the bag for every player still in. Never in the last round, when the bag already holds fewer than that.
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* import { loadTileWordsFromModule } from "@johnmorrisdotca/kumimoji/words";
|
|
279
|
+
* import { judgeWithWords, mayDrawAll, startParty } from "@johnmorrisdotca/kumimoji";
|
|
280
|
+
*
|
|
281
|
+
* const words = await loadTileWordsFromModule("english");
|
|
282
|
+
* const verdict = judgeWithWords(new Map([["0,0","c"],["0,1","a"],["0,2","t"]]),words);
|
|
283
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
284
|
+
* const bag = "catdogsun";
|
|
285
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
286
|
+
* console.log(mayDrawAll(game,verdict));
|
|
287
|
+
* ```
|
|
73
288
|
*/
|
|
74
289
|
export declare function mayDrawAll(game: PartyGame, verdict: GridVerdict): boolean;
|
|
75
290
|
/**
|
|
76
291
|
* DRAW: every player still in takes one tile, in turn order from the one who
|
|
77
292
|
* pressed it — the race game's rule that when one player uses their hand,
|
|
78
293
|
* everybody draws.
|
|
294
|
+
*
|
|
295
|
+
* @param game - The current immutable shared-bag party game.
|
|
296
|
+
* @returns DRAW: every player still in takes one tile, in turn order from the one who pressed it — the race game's rule that when one player uses their hand, everybody draws.
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* import { drawAll, startParty } from "@johnmorrisdotca/kumimoji";
|
|
300
|
+
*
|
|
301
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
302
|
+
* const bag = "catdogsun";
|
|
303
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
304
|
+
* console.log(drawAll(game));
|
|
305
|
+
* ```
|
|
79
306
|
*/
|
|
80
307
|
export declare function drawAll(game: PartyGame): PartyGame;
|
|
81
308
|
/**
|
|
@@ -85,7 +312,34 @@ export declare function drawAll(game: PartyGame): PartyGame;
|
|
|
85
312
|
* screen opens on the table of whoever has just played (the first player's,
|
|
86
313
|
* before anybody has), and a swipe steps round every player in seat order,
|
|
87
314
|
* resigned ones included.
|
|
315
|
+
*
|
|
316
|
+
* @param game - The current immutable shared-bag party game.
|
|
317
|
+
* @returns WHOSE TABLE IS SHOWN. Nothing in a pass-and-play game is secret — John, 2026-09-28: "there are no secrets because they are face up" — so every table and every hand can be looked at by anybody, read-only. The pass screen opens on the table of whoever has just played (the first player's, before anybody has), and a swipe steps round every player in seat order, resigned ones included.
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* import { passViewStart, startParty } from "@johnmorrisdotca/kumimoji";
|
|
321
|
+
*
|
|
322
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
323
|
+
* const bag = "catdogsun";
|
|
324
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
325
|
+
* console.log(passViewStart(game));
|
|
326
|
+
* ```
|
|
88
327
|
*/
|
|
89
328
|
export declare function passViewStart(game: PartyGame): number;
|
|
90
|
-
/** The player a swipe or an arrow shows next: `by` seats on, round the table.
|
|
329
|
+
/** The player a swipe or an arrow shows next: `by` seats on, round the table.
|
|
330
|
+
*
|
|
331
|
+
* @param game - The current immutable shared-bag party game.
|
|
332
|
+
* @param from - The source square or seat index.
|
|
333
|
+
* @param by - The direction or distance to step between seats.
|
|
334
|
+
* @returns The player a swipe or an arrow shows next: `by` seats on, round the table.
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* import { startParty, stepView } from "@johnmorrisdotca/kumimoji";
|
|
338
|
+
*
|
|
339
|
+
* const settings = {size:3,level:"hard",seed:44,gameLength:"short",language:"english",doubleSet:false,diagonals:false,hints:false} as const;
|
|
340
|
+
* const bag = "catdogsun";
|
|
341
|
+
* const game = startParty(settings,bag,["Seat 1","Seat 2"]);
|
|
342
|
+
* console.log(stepView(game,0,1));
|
|
343
|
+
* ```
|
|
344
|
+
*/
|
|
91
345
|
export declare function stepView(game: PartyGame, from: number, by: number): number;
|