@johnmorrisdotca/kumimoji 1.3.0 → 1.3.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 +12 -0
- package/CONTRIBUTING.md +11 -2
- package/README.md +2 -2
- package/dist/check.js +4 -2
- package/dist/computerPlay.js +11 -4
- package/dist/computerTurn.js +5 -2
- package/dist/daily.js +1 -1
- package/dist/element.d.ts +1 -1
- package/dist/element.js +313 -162
- package/dist/export.js +18 -5
- package/dist/generate.js +18 -5
- package/dist/grid.js +26 -4
- package/dist/index.d.ts +22 -22
- package/dist/index.js +22 -22
- package/dist/kana.js +39 -6
- package/dist/party.js +28 -5
- package/dist/partyKept.js +53 -8
- package/dist/partySeats.js +11 -4
- package/dist/partyTurns.js +16 -3
- package/dist/placement.js +5 -2
- package/dist/play.js +14 -3
- package/dist/react.js +33 -3
- package/dist/showcase.js +12 -3
- package/dist/tileWords.js +11 -6
- package/dist/tileWordsModule.d.ts +1 -1
- package/dist/tileWordsModule.js +3 -1
- package/dist/tiles.constants.js +72 -8
- package/dist/turn.js +6 -1
- package/dist/ui/board.js +16 -2
- package/dist/ui/draw.d.ts +62 -0
- package/dist/ui/draw.js +229 -0
- package/dist/ui/mount.js +163 -275
- package/dist/ui/style.d.ts +1 -1
- package/dist/ui/style.js +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wilds.js +3 -2
- package/package.json +12 -13
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ All notable changes to this project are written down here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.3.1] - 2026-10-31
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Biome replaces ESLint as the formatter and linter, with the family's shared settings in `scripts/biome-family.json`; `pnpm lint` checks formatting too, and `pnpm format` applies it. The code is formatted once to 120 columns. Nothing a user of the package sees has changed.
|
|
14
|
+
- TypeScript targets ES2022, treats an indexed read as possibly missing, and refuses switch fallthrough and unmarked overrides.
|
|
15
|
+
- `pnpm check` also holds every source file to at most 500 lines of code (`scripts/check-size.mjs`; blank lines, comments, tests and data files are not counted).
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- The issue chooser's security link shows again: an unquoted colon had made `.github/ISSUE_TEMPLATE/config.yml` invalid YAML.
|
|
20
|
+
|
|
9
21
|
## [1.3.0] - 2026-10-14
|
|
10
22
|
|
|
11
23
|
The table is a custom element with the family's standard embed attributes and a shared builder, and the package has an English and Japanese documentation site with a checked example for every export. The rules, generation, seeds and saved games are unchanged.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -21,7 +21,8 @@ shape before you spend time on it. Taking part follows the
|
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
pnpm install
|
|
24
|
-
pnpm check # lint, types and tests: the same as CI
|
|
24
|
+
pnpm check # format, lint, types, file sizes and tests: the same as CI
|
|
25
|
+
pnpm format # format the code and apply the safe lint fixes
|
|
25
26
|
pnpm test:package # pack it as npm does, install it in an empty project, import every entry
|
|
26
27
|
pnpm site # build the demo into ./site, as GitHub Pages publishes it
|
|
27
28
|
```
|
|
@@ -31,12 +32,18 @@ data scripts) are listed under its own heading below.
|
|
|
31
32
|
|
|
32
33
|
## House rules, shared by every package of the family
|
|
33
34
|
|
|
35
|
+
How the code is written, formatted and checked, and why, is in
|
|
36
|
+
[CODE-STYLE.md](CODE-STYLE.md), the same text in every package.
|
|
37
|
+
|
|
34
38
|
- **No runtime dependencies.** Development dependencies are for tests, builds and
|
|
35
39
|
documentation only.
|
|
36
40
|
- **The core is pure.** Every function in it returns new values and never
|
|
37
41
|
changes what it was given.
|
|
38
42
|
- **Test what you change.** Tests sit beside the code they test. A rule you
|
|
39
43
|
change has a test that would have caught it.
|
|
44
|
+
- **At most 500 lines of code a file** under `src/`, not counting blank lines,
|
|
45
|
+
comments, tests or `*.data.ts` data. A file that reaches it is split by what
|
|
46
|
+
it does, never squeezed.
|
|
40
47
|
- **Words a person reads come in English and Japanese.** If you cannot write the
|
|
41
48
|
Japanese, say so in the pull request and someone will.
|
|
42
49
|
- **Option values and names are kebab case.**
|
|
@@ -48,7 +55,9 @@ data scripts) are listed under its own heading below.
|
|
|
48
55
|
together with the code.
|
|
49
56
|
- **The family's own files are the same in every package**: `demo/family.css`,
|
|
50
57
|
`scripts/family-template.mjs`, `scripts/family-readme.mjs`,
|
|
51
|
-
`scripts/release-notes.mjs`, the files in `scripts/community
|
|
58
|
+
`scripts/release-notes.mjs`, the files in `scripts/community/`,
|
|
59
|
+
`CODE-STYLE.md`, `scripts/biome-family.json`, `scripts/check-size.mjs`,
|
|
60
|
+
`src/embed-attributes.ts` where the package has an element, and
|
|
52
61
|
`family.test.js` (in `src/`, or in `test/`). Do not edit one here. To change
|
|
53
62
|
one, change it in every repository at once, bump `FAMILY_TEMPLATE_VERSION` for
|
|
54
63
|
the template, and record the new hash in `family.test.js`. What is the
|
package/README.md
CHANGED
|
@@ -768,7 +768,7 @@ The JSON, as `kumimojiToJSON` writes it:
|
|
|
768
768
|
{
|
|
769
769
|
"format": 1,
|
|
770
770
|
"game": "kumimoji",
|
|
771
|
-
"generator": "kumimoji 1.3.
|
|
771
|
+
"generator": "kumimoji 1.3.1",
|
|
772
772
|
"size": 3,
|
|
773
773
|
"level": "hard",
|
|
774
774
|
"seed": 44,
|
|
@@ -1201,7 +1201,7 @@ Please follow the [code of conduct](./CODE_OF_CONDUCT.md). A way to make a check
|
|
|
1201
1201
|
|
|
1202
1202
|
See [CHANGELOG.md](./CHANGELOG.md).
|
|
1203
1203
|
|
|
1204
|
-
The latest release
|
|
1204
|
+
The latest release, 1.3.1, changes nothing a player sees.
|
|
1205
1205
|
|
|
1206
1206
|
## Licence
|
|
1207
1207
|
|
package/dist/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decodeGrid, lettersOf, sameLetters } from "./grid.js";
|
|
2
2
|
import { judgeWithWords } from "./judge.js";
|
|
3
|
-
import { kumimojiTileCount, kumimojiWildCount,
|
|
3
|
+
import { KUMIMOJI_SCORE, kumimojiTileCount, kumimojiWildCount, TILE_MIX_TOTAL } from "./tiles.constants.js";
|
|
4
4
|
import { tileWords } from "./tileWords.js";
|
|
5
5
|
/**
|
|
6
6
|
* WHETHER A GRID FINISHES A KUMIMOJI: the one check the server also runs.
|
|
@@ -62,7 +62,9 @@ export function checkKumimoji(size, givens, answer, options = {}) {
|
|
|
62
62
|
return { ok: false, reason: "the answer is not a grid" };
|
|
63
63
|
const bagIdentities = bag.map(words.familyKey);
|
|
64
64
|
const tileIdentities = [...tiles.values()].map(words.familyKey);
|
|
65
|
-
if (bagIdentities.some((tile) => tile === null) ||
|
|
65
|
+
if (bagIdentities.some((tile) => tile === null) ||
|
|
66
|
+
tileIdentities.some((tile) => tile === null) ||
|
|
67
|
+
!sameLetters(lettersOf(tileIdentities), lettersOf(bagIdentities))) {
|
|
66
68
|
return { ok: false, reason: "the grid does not use exactly the tiles of the bag" };
|
|
67
69
|
}
|
|
68
70
|
const verdict = judgeWithWords(tiles, words, { diagonals: options.diagonals === true });
|
package/dist/computerPlay.js
CHANGED
|
@@ -76,7 +76,7 @@ function lacking(word, hand, most) {
|
|
|
76
76
|
/** How many tiles already down one word may run through: two lets it bridge a gap, as players do. */
|
|
77
77
|
const CROSSED_MOST = 2;
|
|
78
78
|
/** How many placements are tried in one search at most, so a turn's thinking stays a fraction of a second on a phone. */
|
|
79
|
-
const FITS_MOST =
|
|
79
|
+
const FITS_MOST = 20_000;
|
|
80
80
|
/** A laying's worth: tiles used first, rare letters next, wilds spent last. */
|
|
81
81
|
function worth(fresh, wilds, words) {
|
|
82
82
|
let rare = 0;
|
|
@@ -118,7 +118,8 @@ function layings(play, words, rules) {
|
|
|
118
118
|
}
|
|
119
119
|
const bounds = boundsOf(play.tiles);
|
|
120
120
|
const fits = (first, last) => bounds === null ||
|
|
121
|
-
(Math.max(bounds.bottom, last.row) - Math.min(bounds.top, first.row) < KUMIMOJI_GRID_MOST &&
|
|
121
|
+
(Math.max(bounds.bottom, last.row) - Math.min(bounds.top, first.row) < KUMIMOJI_GRID_MOST &&
|
|
122
|
+
Math.max(bounds.right, last.col) - Math.min(bounds.left, first.col) < KUMIMOJI_GRID_MOST);
|
|
122
123
|
const found = [];
|
|
123
124
|
let tried = 0;
|
|
124
125
|
let mostFresh = 0;
|
|
@@ -150,9 +151,15 @@ function layings(play, words, rules) {
|
|
|
150
151
|
if (fit === null)
|
|
151
152
|
continue;
|
|
152
153
|
const step = across ? { row: 0, col: 1 } : { row: 1, col: 0 };
|
|
153
|
-
if (!fits(fit.first, {
|
|
154
|
+
if (!fits(fit.first, {
|
|
155
|
+
row: fit.first.row + (length - 1) * step.row,
|
|
156
|
+
col: fit.first.col + (length - 1) * step.col,
|
|
157
|
+
}))
|
|
154
158
|
continue;
|
|
155
|
-
const fresh = fit.fresh.map((square) => ({
|
|
159
|
+
const fresh = fit.fresh.map((square) => ({
|
|
160
|
+
square: squareAt(square.row, square.col),
|
|
161
|
+
letter: word[square.row - fit.first.row + (square.col - fit.first.col)],
|
|
162
|
+
}));
|
|
156
163
|
const wilds = wildsNeeded(fresh, hand);
|
|
157
164
|
if (wilds !== null)
|
|
158
165
|
keep({ word, fresh, wilds, score: worth(fresh, wilds, words) });
|
package/dist/computerTurn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bestLaying, judgeTiles, tradeChoice } from "./computerPlay.js";
|
|
2
2
|
import { drawAll, isComputer, mayDrawAll, mayTradeThisTurn, seatPlay, withSeatPlay } from "./party.js";
|
|
3
|
-
import { doneRefused, endTurn, goesOut, handCanSpell, isLastTurn, laidThisTurn, mayResign, resign } from "./partyTurns.js";
|
|
3
|
+
import { doneRefused, endTurn, goesOut, handCanSpell, isLastTurn, laidThisTurn, mayResign, resign, } from "./partyTurns.js";
|
|
4
4
|
import { liftAll, mayTrade, trade } from "./play.js";
|
|
5
5
|
/**
|
|
6
6
|
* A COMPUTER'S TURN in a pass-and-play game (John, 2026-09-28: "Also you can
|
|
@@ -100,7 +100,10 @@ export function planComputerTurn(game, words) {
|
|
|
100
100
|
break;
|
|
101
101
|
}
|
|
102
102
|
const hand = now.players[now.turn].hand;
|
|
103
|
-
const stuck = hand.length > 0 &&
|
|
103
|
+
const stuck = hand.length > 0 &&
|
|
104
|
+
!laidThisTurn(now) &&
|
|
105
|
+
!mayTrade(seatPlay(now)) &&
|
|
106
|
+
bestLaying(seatPlay(now), words, rules) === null;
|
|
104
107
|
const refused = doneRefused(now, verdict(), handSpells) !== null;
|
|
105
108
|
if ((refused || (stuck && !isLastTurn(now))) && mayResign(now)) {
|
|
106
109
|
take(resign(now), { kind: "resigned" });
|
package/dist/daily.js
CHANGED
package/dist/element.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type KumimojiTableHandle, type KumimojiTableOptions } from "./ui/mount.ts";
|
|
2
1
|
import type { KumimojiSaved } from "./export.ts";
|
|
2
|
+
import { type KumimojiTableHandle, type KumimojiTableOptions } from "./ui/mount.ts";
|
|
3
3
|
declare const ElementBase: typeof HTMLElement;
|
|
4
4
|
/**
|
|
5
5
|
* THE `<kumimoji-table>` ELEMENT: a game of Kumimoji alone in a tag, with no
|