forked from WikiDeck/wikideck
Merge night/2026-11-16 (#27, #28, #24); card-data from the final 236-card sample and council-data's published percentiles
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+107
-56
@@ -1,67 +1,119 @@
|
||||
# Card data: real stat distributions (council-data)
|
||||
|
||||
Status: **interim**, generated 2026-11-16 23:06 EST. The full 330-card run is still fetching pageviews politely; this file and `card-sample.json` will be regenerated.
|
||||
Status: **final for tonight**, 236 fully enriched cards, generated 2026-11-16 23:20 EST. Sampling stopped early on night-lead's request because Wikimedia was rate-limiting (429) our shared egress IP. 330 cards were picked; the first 236 finished enrichment.
|
||||
|
||||
Method: `scripts/night/card_sample.py` draws random ns0 articles in batches of 20 and keeps those passing the `server/wiki.ts` filter (thumbnail from upload/thumb.wikimedia.org, intro extract of at least 40 characters). It enriches them with the same API parameters as `server/enrichment.ts`: six completed months Jun–Oct 2026; attention uses October. It adds Wikidata P31 and 30-day drift (views 10-17..11-15 vs 09-17..10-16). `scripts/night/card_analyze.py` produces the tables below.
|
||||
**Method:** `scripts/night/card_sample.py` draws random ns0 articles in batches of 20 and keeps those that pass the `server/wiki.ts` filter: a thumbnail from upload/thumb.wikimedia.org and an intro extract of at least 40 characters. About 44% of random pages pass. Each card is enriched with the same API parameters as `server/enrichment.ts`:
|
||||
- six completed months, Jun–Oct 2026; attention uses October
|
||||
- monthly views summed from the daily REST pageviews
|
||||
|
||||
## Headline findings (INTERIM: 100 fully enriched random illustrated cards; 330 sampled, rest still fetching under Wikimedia 429 rate limits)
|
||||
On top of that it adds Wikidata P31 and a 30-day drift (views 10-17..11-15 vs 09-17..10-16).
|
||||
|
||||
1. **Raw stats are compressed and skewed.** Median card: attention 33, depth 63, reach 24 (p10–p90: attention 23–53, depth 54–71, reach 9–48). No card above 81 on anything; 100 is unreachable honestly. **Use the 1–10 tier tables below (sample deciles), not 0–100.**
|
||||
2. **Correlation is weaker than feared, except attention↔depth (Spearman 0.59).** Reach is nearly independent of both (0.10 / 0.02): stub villages get many bot-made language editions. So reach is a real separate axis; attention+depth partly double-count fame.
|
||||
3. **Underlying raw values are very long-tailed:** monthly views median 94 (p90 1,438, max 14k); pageBytes median 6 KB; languageCount median 4, and **10% have 0 other languages** (reach 0).
|
||||
4. **Trend is mostly negative:** 69% of cards have trendPercent < 0 (median −10%), 31% positive, 14% swing by more than 50%. Null is rare (1%). A "Trending" keyword fires for about a third of cards: fine as a small ±1.
|
||||
5. **Live values are fairly stable in score terms:** 30-day pageview drift median |18%| (p90 55%), but that moves the attention score by only a median of **1.4 points** (p90 5.6). So "live vs. mint" differences are small for random cards; big swings only come from deliberate inflation (see the critic's point A4).
|
||||
6. **The legacy `category()` buckets are unusable as factions:** Culture 53%, People 30%, Nature 9%, History 5%, Science 3%, **Space 0%**.
|
||||
7. **Candidate factions from Wikidata P31 (instance of), clean and readable:** People 31%, Places 25%, Nature 10%, Structures 6%, Works 5%, Events 5%, Sport 3%, Ideas & Tech 3%, Organisations 2%, unclassified 10%. Suggest **6 factions**: People, Places, Nature, Works & Culture (Works + Organisations + Sport), Structures, Events & Ideas (Events + Ideas & Tech), plus a neutral fallback. People and Places are big, so faction bonuses should scale with *share in deck*, not raw count, or the small factions need their own perks.
|
||||
8. **Starter/loaner list:** frozen stats for up to 4 cards per legacy category, spread across tiers, in `docs/game/starter-cards.json` (Space has no sample cards: hand-pick e.g. the Moon from `shared/catalog.ts`).
|
||||
**Politeness:** the sampler runs serially at 1 request a second or slower, honours Retry-After, and caches every response to disk. `scripts/night/card_analyze.py` produces everything below, plus the `percentiles` (99 cut points each, for DESIGN §1.1) in `card-sample.json`.
|
||||
|
||||
## Files
|
||||
- `card-sample.json`: `cards[]` with the `PageEnrichment` shape, plus `category` (legacy `category()`), `instanceOf` (P31), `faction` (the P31 rules below), `tiers` and `drift30`. Top level: `percentiles`, `tierBreakpoints`, `factionRules` and `note`.
|
||||
- `starter-cards.json`: the loaner **pool**, 20 real frozen snapshots (a `MintStatsSnapshot` in `snapshot`). It also holds `starterDeckPageIds`: the 48 DESIGN §2.1 starter titles with their real pageIds and `cardId`s.
|
||||
|
||||
## Headline findings (236 cards)
|
||||
1. **Raw scores are compressed.**
|
||||
|
||||
| score | median | p10–p90 | max |
|
||||
|---|---|---|---|
|
||||
| attention | 32 | 20–53 | 77 |
|
||||
| depth | 63 | 54–73 | 87 |
|
||||
| reach | 20 | 0–45 | 70 |
|
||||
|
||||
No honest card reaches 100. Use `percentiles` (§1.1) or the 1–10 tiers, never the raw 0–100 values.
|
||||
2. **Correlations (Spearman):**
|
||||
- attention and depth: 0.61, so these two double-count fame
|
||||
- reach is nearly independent of both (0.17 with attention, 0.02 with depth)
|
||||
3. **Reach has a hard floor:** 18% of cards (42) have 0 other languages, so reach is 0. Under the §1.1 counting, all of them get pct_reach of about 8.
|
||||
4. **Raw values are long-tailed:**
|
||||
|
||||
| value | median | p90 | max |
|
||||
|---|---|---|---|
|
||||
| monthly views | 82 | 1,576 | 42k |
|
||||
| pageBytes | 6.1 KB | 24 KB | |
|
||||
| languageCount | 3 | 22 | |
|
||||
5. **Trend is mostly down:**
|
||||
- 65% of cards have a negative trendPercent, 34% positive; median −9.5%
|
||||
- 16% swing by more than 50% either way
|
||||
- null: 1%
|
||||
6. **Live drift is small in score terms.** The 30-day median |pageview drift| is 22% (p90 60%). That moves attention by only **1.7 points** (p90 6.3), so at-mint and live values differ little unless someone inflates them.
|
||||
7. **The legacy `category()` split is very skewed:**
|
||||
|
||||
| category | share |
|
||||
|---|---|
|
||||
| Culture | 56% |
|
||||
| People | 26% |
|
||||
| Nature | 8% |
|
||||
| History | 8% |
|
||||
| Science | 1% |
|
||||
| Space | 0.4% |
|
||||
8. **Candidate factions from P31:**
|
||||
|
||||
| faction | share |
|
||||
|---|---|
|
||||
| People | 29% |
|
||||
| Places | 20% |
|
||||
| Nature | 8% |
|
||||
| Structures | 7% |
|
||||
| Works | 5% |
|
||||
| Events | 5% |
|
||||
| Organisations | 4% |
|
||||
| Ideas & Tech | 3% |
|
||||
| Sport | 3% |
|
||||
| unclassified | 14% |
|
||||
|
||||
Suggested 6 for v2: People, Places, Nature, Works & Culture (Works + Organisations + Sport), Structures, Events & Ideas, plus a neutral fallback.
|
||||
|
||||
## Full tables
|
||||
|
||||
Sample: **100 cards**; ~44% (149/340 logged during sampling) of random pages pass the illustrated filter. Pageviews available for 100.
|
||||
Sample: **236 cards**; ~44% (149/340 logged during sampling) of random pages pass the illustrated filter. Pageviews available for 236.
|
||||
|
||||
| stat | n | min | p10 | p25 | median | p75 | p90 | max | mean | skew |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| attention | 100 | 13 | 23 | 27 | 33 | 41 | 53 | 69 | 35 | 0.75 |
|
||||
| depth | 100 | 50 | 54 | 59 | 63 | 68 | 71 | 81 | 63 | 0.24 |
|
||||
| reach | 100 | 0 | 9 | 16 | 24 | 36 | 48 | 59 | 26 | 0.11 |
|
||||
| pageBytes | 100 | 998 | 1804 | 3407 | 6018 | 12512 | 19161 | 74169 | 9885 | 3.20 |
|
||||
| languageCount | 100 | 0 | 1 | 2 | 4 | 11 | 27 | 56 | 9 | 1.83 |
|
||||
| monthlyViews | 100 | 5 | 22 | 43 | 94 | 277 | 1438 | 14374 | 611 | 5.76 |
|
||||
| dailyAverage | 100 | 0.2 | 0.7 | 1.4 | 3.0 | 8.9 | 46.4 | 463.7 | 19.7 | 5.76 |
|
||||
| trendPercent | 99 | -86.6 | -45.1 | -26.4 | -10.4 | 4.5 | 21.1 | 187.1 | -9.5 | 1.83 |
|
||||
| drift30Percent | 99 | -94.7 | -45.9 | -30.7 | -12.7 | -1.7 | 14.8 | 72.1 | -16.1 | -0.20 |
|
||||
| attention | 236 | 13 | 20 | 25 | 32 | 41 | 53 | 77 | 35 | 0.78 |
|
||||
| depth | 236 | 48 | 54 | 58 | 63 | 68 | 73 | 87 | 64 | 0.42 |
|
||||
| reach | 236 | 0 | 0 | 10 | 20 | 33 | 45 | 70 | 23 | 0.36 |
|
||||
| pageBytes | 236 | 772 | 1847 | 3084 | 6110 | 12805 | 24412 | 168332 | 11691 | 4.61 |
|
||||
| languageCount | 236 | 0 | 0 | 1 | 3 | 9 | 22 | 124 | 8 | 4.14 |
|
||||
| monthlyViews | 236 | 5 | 16 | 30 | 82 | 300 | 1576 | 42025 | 812 | 9.82 |
|
||||
| dailyAverage | 236 | 0.2 | 0.5 | 1.0 | 2.6 | 9.7 | 50.8 | 1355.6 | 26.2 | 9.82 |
|
||||
| trendPercent | 234 | -86.6 | -49.3 | -26.3 | -9.5 | 5.3 | 31.2 | 388.9 | -3.6 | 4.11 |
|
||||
| drift30Percent | 235 | -94.7 | -58.2 | -33.8 | -12.9 | 1.0 | 27.7 | 2268.7 | -4.2 | 14.07 |
|
||||
|
||||
**Spearman rank correlations** (cards with pageviews):
|
||||
|
||||
| | attention | depth | reach | trendPercent | drift30Percent |
|
||||
|---|---|---|---|---|---|
|
||||
| attention | 1.00 | 0.59 | 0.10 | 0.24 | 0.25 |
|
||||
| depth | 0.59 | 1.00 | 0.02 | 0.07 | 0.05 |
|
||||
| reach | 0.10 | 0.02 | 1.00 | -0.10 | 0.24 |
|
||||
| trendPercent | 0.24 | 0.07 | -0.10 | 1.00 | 0.53 |
|
||||
| drift30Percent | 0.25 | 0.05 | 0.24 | 0.53 | 1.00 |
|
||||
| attention | 1.00 | 0.61 | 0.17 | 0.35 | 0.33 |
|
||||
| depth | 0.61 | 1.00 | 0.02 | 0.15 | 0.14 |
|
||||
| reach | 0.17 | 0.02 | 1.00 | 0.00 | 0.09 |
|
||||
| trendPercent | 0.35 | 0.15 | 0.00 | 1.00 | 0.31 |
|
||||
| drift30Percent | 0.33 | 0.14 | 0.09 | 0.31 | 1.00 |
|
||||
|
||||
(n=99; attention~monthlyViews, depth~pageBytes, reach~languageCount are monotonic so their rank correlations are identical.)
|
||||
(n=234; attention~monthlyViews, depth~pageBytes, reach~languageCount are monotonic so their rank correlations are identical.)
|
||||
|
||||
**trendPercent sign:** positive 31 (31%), negative 68 (69%), zero 0; null (prior month 0 or no views) 1. |trend| > 50%: 14; > 100%: 1.
|
||||
**trendPercent sign:** positive 79 (34%), negative 153 (65%), zero 2; null (prior month 0 or no views) 2. |trend| > 50%: 38; > 100%: 7.
|
||||
|
||||
**30-day drift** (views 10-17..11-15 vs 09-17..10-16): median |drift| 18%, p90 |drift| 55%. Attention score change implied: median 1.4 points, p90 5.6 points.
|
||||
**30-day drift** (views 10-17..11-15 vs 09-17..10-16): median |drift| 22%, p90 |drift| 60%. Attention score change implied: median 1.7 points, p90 6.3 points.
|
||||
|
||||
**attention histogram (deciles 0-9,10-19..90-100):** 0 4 30 39 12 11 4 0 0 0
|
||||
**depth histogram (deciles 0-9,10-19..90-100):** 0 0 0 0 0 30 53 15 2 0
|
||||
**reach histogram (deciles 0-9,10-19..90-100):** 10 25 23 23 10 9 0 0 0 0
|
||||
**attention histogram (deciles 0-9,10-19..90-100):** 0 19 74 74 36 20 12 1 0 0
|
||||
**depth histogram (deciles 0-9,10-19..90-100):** 0 0 0 0 2 72 117 38 7 0
|
||||
**reach histogram (deciles 0-9,10-19..90-100):** 42 60 53 43 21 15 1 1 0 0
|
||||
|
||||
Reach = 0 (no other languages): 10; reach 100 (>=999 langs) impossible in practice, max langs 56. Attention null: 0; attention 0: 0.
|
||||
Reach = 0 (no other languages): 42; reach 100 (>=999 langs) impossible in practice, max langs 124. Attention null: 0; attention 0: 0.
|
||||
|
||||
**Sum of three stats:** min 84, p10 97, p25 107, median 120, p75 140, p90 155, max 193
|
||||
**Sum of three stats:** min 73, p10 89, p25 102, median 116, p75 135, p90 156, max 222
|
||||
|
||||
**Legacy `category()` (server/wiki.ts):** Culture 53, People 30, Nature 9, History 5, Science 3
|
||||
**Legacy `category()` (server/wiki.ts):** Culture 133, People 62, Nature 19, History 18, Science 3, Space 1
|
||||
|
||||
**Top Wikidata P31 classes:** human 30, taxon 8, river 4, village 4, commune of France 3, musical group 2, building 2, castle 2, rural municipality of Austria 1, municipality of Austria 1, municipality of Brazil 1, television film 1, nor'easter 1, rail company (Japan) 1, village of Poland 1, municipality 1, civil parish 1, association football match 1, final 1, local government area of Victoria 1, plant disease 1, basketball team season 1, mosque 1, functional programming language 1, purely functional programming language 1, dependently typed programming language 1, programming language 1, free software 1, proof assistant 1, municipality of Croatia 1, municipality of Bangladesh 1, town 1, town in the United States 1, municipality of Georgia 1, epiphyte 1, protest 1, region of Mauritania 1, legislative election 1, musical work/composition 1, plateau 1
|
||||
**Top Wikidata P31 classes:** human 64, taxon 16, village 7, commune of France 6, river 5, human settlement 4, musical group 3, building 3, gene 3, village of Poland 2, civil parish 2, protest 2, legislative election 2, castle 2, events in a specific year or time period 2, township of Pennsylvania 2, film 2, company 2, island 2, rural municipality of Austria 1, municipality of Austria 1, municipality of Brazil 1, television film 1, nor'easter 1, rail company (Japan) 1, municipality 1, association football match 1, final 1, local government area of Victoria 1, plant disease 1, basketball team season 1, mosque 1, functional programming language 1, purely functional programming language 1, dependently typed programming language 1, programming language 1, free software 1, proof assistant 1, municipality of Croatia 1, municipality of Bangladesh 1
|
||||
|
||||
No Wikidata item: 0; no P31: 6
|
||||
No Wikidata item: 0; no P31: 13
|
||||
|
||||
**Most frequent category words (cards containing):** stubs 35, births 27, people 26, from 24, century 22, living 16, geography 15, deaths 14, american 13, county 9, university 8, male 7, united 7, film 7, players 7, district 6, states 6, sports 6, biography 6, television 5, alumni 5, genera 5, established 5, villages 5, football 5, city 5, buildings 5, expatriate 5, sportspeople 5, sportsmen 5, towns 4, municipalities 4, writers 4, women 4, faculty 4, communes 4, rivers 4, places 4, establishments 4, actors 4, california 4, russian 4, association 4, structures 4, described 3, british 3, french 3, ohio 3, academics 3, based 3, japanese 3, pennsylvania 3, argentine 3, australia 3, populated 3, directors 3, rock 3, musical 3, conference 3, division 3
|
||||
**Most frequent category words (cards containing):** stubs 81, births 55, people 50, from 50, century 46, living 33, geography 30, american 29, deaths 28, united 27, county 27, states 23, established 21, establishments 20, alumni 18, places 17, university 16, buildings 16, state 15, national 14, structures 14, male 13, players 12, district 11, villages 11, sportsmen 11, members 11, described 10, football 10, sports 10, city 10, film 10, british 9, companies 9, populated 9, sportspeople 9, biography 9, york 9, women 8, taxa 8, germany 8, politicians 8, television 7, writers 7, french 7, genera 7, based 7, communes 7, language 7, expatriate 7, named 7, olympics 7, completed 7, historic 7, register 7, faculty 6, pennsylvania 6, civil 6, history 6, california 6
|
||||
|
||||
|
||||
## Rank-normalised tiers (1–10)
|
||||
@@ -70,29 +122,28 @@ Tier = 1 + number of breakpoints the score is **>=**. Breakpoints are the sample
|
||||
|
||||
| stat | p10 | p20 | p30 | p40 | p50 | p60 | p70 | p80 | p90 |
|
||||
|---|---|---|---|---|---|---|---|---|---|
|
||||
| attention | 23 | 25 | 28 | 31 | 33 | 36 | 38 | 45 | 53 |
|
||||
| depth | 54 | 57 | 60 | 61 | 63 | 65 | 67 | 69 | 72 |
|
||||
| reach | 10 | 10 | 16 | 20 | 26 | 30 | 36 | 39 | 49 |
|
||||
| attention | 20 | 24 | 27 | 30 | 32 | 35 | 39 | 44 | 53 |
|
||||
| depth | 54 | 57 | 59 | 61 | 63 | 65 | 67 | 69 | 73 |
|
||||
| reach | 0 | 10 | 10 | 16 | 20 | 26 | 30 | 36 | 45 |
|
||||
|
||||
Resulting tier counts — attention: None:0 1:10 2:9 3:7 4:14 5:8 6:12 7:7 8:12 9:10 10:11
|
||||
; depth: 1:7 2:11 3:12 4:6 5:11 6:11 7:9 8:9 9:14 10:10
|
||||
; reach: 1:10 2:0 3:13 4:12 5:15 6:8 7:11 8:10 9:11 10:10
|
||||
Resulting tier counts — attention: None:0 1:19 2:27 3:24 4:23 5:23 6:17 7:28 8:25 9:22 10:28
|
||||
; depth: 1:14 2:23 3:26 4:21 5:25 6:26 7:22 8:21 9:30 10:28
|
||||
; reach: 1:0 2:42 3:0 4:30 5:30 6:32 7:21 8:27 9:27 10:27
|
||||
|
||||
Starter candidates: 19 written to /tmp/claude-1000/-home-eric-worker-jobs-night-council-data/d4e31987-ce7f-4f28-8262-8f0225215102/scratchpad/starter.json: Counter({'Nature': 4, 'People': 4, 'History': 4, 'Culture': 4, 'Science': 3})
|
||||
|
||||
## Candidate factions (Wikidata P31 rules)
|
||||
|
||||
| faction | n | share | median attention | median depth | median reach | example |
|
||||
|---|---|---|---|---|---|---|
|
||||
| People | 31 | 31% | 33 | 65 | 26 | Salahuddin of Aceh |
|
||||
| Places | 25 | 25% | 28 | 61 | 36 | St. Georgen am Längsee |
|
||||
| Nature | 10 | 10% | 30 | 56 | 31 | Dichromorpha viridis |
|
||||
| Other | 10 | 10% | 52 | 64 | 22 | Village (Pennsylvania) |
|
||||
| Structures | 6 | 6% | 32 | 58 | 16 | Pathrail Mosque |
|
||||
| Works | 5 | 5% | 40 | 64 | 16 | The Best of Men |
|
||||
| Events | 5 | 5% | 38 | 72 | 10 | April 2021 nor'easter |
|
||||
| Sport | 3 | 3% | 25 | 71 | 0 | 1912 Argentine Primera División final |
|
||||
| Ideas & Tech | 3 | 3% | 37 | 62 | 20 | Agda (programming language) |
|
||||
| Organisations | 2 | 2% | 50 | 62 | 24 | Hiroshima Electric Railway |
|
||||
| People | 68 | 29% | 31 | 65 | 22 | Salahuddin of Aceh |
|
||||
| Places | 48 | 20% | 28 | 61 | 32 | St. Georgen am Längsee |
|
||||
| Other | 34 | 14% | 40 | 65 | 16 | Village (Pennsylvania) |
|
||||
| Nature | 20 | 8% | 30 | 56 | 29 | Dichromorpha viridis |
|
||||
| Structures | 17 | 7% | 26 | 57 | 10 | Pathrail Mosque |
|
||||
| Works | 12 | 5% | 36 | 63 | 13 | The Best of Men |
|
||||
| Events | 12 | 5% | 40 | 72 | 13 | April 2021 nor'easter |
|
||||
| Organisations | 10 | 4% | 48 | 68 | 10 | Hiroshima Electric Railway |
|
||||
| Ideas & Tech | 8 | 3% | 30 | 63 | 16 | Agda (programming language) |
|
||||
| Sport | 7 | 3% | 27 | 70 | 16 | 1912 Argentine Primera División final |
|
||||
|
||||
Unclassified P31 labels: typeface 1, annexation 1, position 1, family 1
|
||||
Unclassified P31 labels: typeface 1, annexation 1, position 1, family 1, historic site 1, automobile manufacturer 1, historical society 1, stock character 1, pigeon breed 1, shopping center 1, Wikimedia list article 1, clinical sign 1, tram route 1, rubber-tyred tram 1, oil refinery 1, waterfall 1, orisha 1, water deity 1, Loa 1, arch 1, award 1, sex scandal 1, military base 1, artillery battery 1
|
||||
|
||||
+3
-1
@@ -160,7 +160,9 @@ These are the default `starterDecks`: four 12-card loaner decks.
|
||||
Everything after them still applies: `powerByCost`, `onTopicBonus`, `vanillaBonus`, the §10.1 keyword choice and `keywordParams`.
|
||||
A mode that changes those numbers changes loaners exactly as it changes owned cards.
|
||||
- **Pinned cost isn't fame.** Cost was set by hand to fit the curve, not from the article's fame. Rarity is `Common` (frame only) and trend is 0.
|
||||
- **Loaner ids:** `cardId` = `loaner:<kebab-title>`, and `pageId` = the article's real pageId if the UI has it, otherwise `null`. Copies are counted per `cardId`.
|
||||
- **Loaner ids:** `cardId` = `loaner:<kebab-title>`, and `pageId` = the article's real pageId (v1 pins the 4 `shared/catalog.ts` ones: Moon 19331, Periodic table 23053, Octopus 22780,
|
||||
Albert Einstein 736; the rest are filled in from one batched API call in v1.1, `null` until then). The copy limit counts per `pageId`
|
||||
together with owned copies (§2); a loaner with `pageId: null` counts per `cardId`.
|
||||
- **Relation to `docs/game/starter-cards.json`** (council-data, real frozen snapshots of random articles): that file is the
|
||||
**loaner pool** for the sim and for "fill a slot with a loaner" in the deck builder. It is **not** the default starter decks.
|
||||
The decks below pin their values on purpose, for two reasons. Famous, recognisable articles would all derive to cost 5–6.
|
||||
|
||||
+11703
-104
File diff suppressed because it is too large
Load Diff
+1678
-302
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,11 @@ function cuts(values) {
|
||||
if (sorted.length < 2) throw new Error('sample too small');
|
||||
return Array.from({ length: 99 }, (_, i) => sorted[Math.min(sorted.length - 1, Math.floor((i + 1) * sorted.length / 100))]);
|
||||
}
|
||||
const table = Object.fromEntries(['attention', 'depth', 'reach'].map(stat => [stat, cuts(sample.cards.map(c => c.stats?.[stat]))]));
|
||||
// Prefer council-data's published table (card-sample.json `percentiles`); fall back to computing it.
|
||||
const official = sample.percentiles && ['attention', 'depth', 'reach'].every(stat => sample.percentiles[stat]?.length === 99);
|
||||
const table = official ? { attention: sample.percentiles.attention, depth: sample.percentiles.depth, reach: sample.percentiles.reach }
|
||||
: Object.fromEntries(['attention', 'depth', 'reach'].map(stat => [stat, cuts(sample.cards.map(c => c.stats?.[stat]))]));
|
||||
const method = official ? sample.percentilesMethod : 'computed here: value at rank floor(k*n/100)';
|
||||
|
||||
const daysIn = month => { const [y, m] = month.split('-').map(Number); return new Date(Date.UTC(y, m, 0)).getUTCDate(); };
|
||||
const pool = starter.cards.map(c => ({
|
||||
@@ -27,6 +31,7 @@ const pool = starter.cards.map(c => ({
|
||||
|
||||
const out = `// GENERATED by scripts/game-card-data.mjs from docs/game/card-sample.json (${sample.cards.length} cards,
|
||||
// generated ${sample.generatedAt}) and docs/game/starter-cards.json (frozen ${starter.frozenAt}). Do not edit by hand.
|
||||
// Percentiles: ${method}
|
||||
import type { PercentileTable } from './derive.ts';
|
||||
import type { Faction } from './types.ts';
|
||||
|
||||
|
||||
@@ -137,3 +137,20 @@ for name, cs in sorted(by.items(), key=lambda kv: -len(kv[1])):
|
||||
other = collections.Counter(x['label'] for c in by.get('Other', []) for x in c['instanceOf'])
|
||||
print('\nUnclassified P31 labels: ' + ', '.join(f'{k} {v}' for k, v in other.most_common(25)))
|
||||
if len(sys.argv) > 4: json.dump({c['pageId']: c['faction'] for c in C}, open(sys.argv[4], 'w'))
|
||||
if len(sys.argv) > 3:
|
||||
s = json.load(open(sys.argv[3])); fmap = {c['pageId']: c['faction'] for c in C}
|
||||
for p in s['cards']: p['faction'] = fmap[p['pageId']]
|
||||
json.dump(s, open(sys.argv[3], 'w'), indent=1, ensure_ascii=False)
|
||||
if len(sys.argv) > 5:
|
||||
d['factionRules'] = [[n, rx] for n, rx in FAC]; d['tierBreakpoints'] = T
|
||||
def cuts(k):
|
||||
v = sorted(c['stats'][k] for c in C if c['stats'][k] is not None); n = len(v)
|
||||
return [v[max(0, math.ceil(i * n / 100) - 1)] for i in range(1, 100)]
|
||||
d['percentiles'] = {k: cuts(k) for k in ('attention', 'depth', 'reach')}
|
||||
d['percentilesMethod'] = 'cut point i (1..99) = nearest-rank i-th percentile of the sample snapshot score (sorted ascending, index ceil(i*n/100)-1). Use with DESIGN.md §1.1 counting.'
|
||||
if not d['rawPagesSeen']:
|
||||
d['randomBatches'], d['rawPagesSeen'] = 17, 340
|
||||
d['randomBatchesNote'] = 'Sampling was resumed from a saved state, so full batch counts were lost. These are the counts logged at batch 17 (149 illustrated of 340 raw pages, 44% pass rate). The 330 picked cards came from about 38 batches; this sample holds the first N of those that finished enrichment before sampling stopped (Wikimedia 429s).'
|
||||
d['note'] = 'docs/game/starter-cards.json is the loaner POOL (real frozen snapshots of random articles), used by the sim and the deck builder to fill slots. The default starter decks are defined in DESIGN.md §2.1; their real pageIds are in starter-cards.json under starterDeckPageIds.'
|
||||
for c in d['cards']: c['category'] = c['legacyCategory']
|
||||
json.dump(d, open(sys.argv[5], 'w'), indent=1, ensure_ascii=False)
|
||||
|
||||
@@ -17,7 +17,7 @@ def get(url, cache=True):
|
||||
if os.environ.get('CACHE_ONLY') and 'wikidata.org' not in url:
|
||||
return {'__missing': True}
|
||||
for attempt in range(6):
|
||||
wait = (1.0 if 'en.wikipedia.org' in url else 0.25) - (time.time() - _last[0])
|
||||
wait = 1.0 - (time.time() - _last[0])
|
||||
if wait > 0: time.sleep(wait)
|
||||
_last[0] = time.time()
|
||||
req = urllib.request.Request(url, headers={'User-Agent': UA, 'Accept': 'application/json'})
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// GENERATED by scripts/game-card-data.mjs from docs/game/card-sample.json (100 cards,
|
||||
// generated 2026-11-17T04:05:04.081324+00:00) and docs/game/starter-cards.json (frozen 2026-11-17). Do not edit by hand.
|
||||
// GENERATED by scripts/game-card-data.mjs from docs/game/card-sample.json (236 cards,
|
||||
// generated 2026-11-17T04:19:07.777994+00:00) and docs/game/starter-cards.json (frozen 2026-11-17). Do not edit by hand.
|
||||
// Percentiles: cut point i (1..99) = nearest-rank i-th percentile of the sample snapshot score (sorted ascending, index ceil(i*n/100)-1). Use with DESIGN.md §1.1 counting.
|
||||
import type { PercentileTable } from './derive.ts';
|
||||
import type { Faction } from './types.ts';
|
||||
|
||||
/** DESIGN §1.1 reference table "card-sample-2026-11-16": 99 cut points per stat. */
|
||||
export const CARD_SAMPLE_PERCENTILES: PercentileTable = {"attention":[17,18,18,20,21,21,21,22,22,23,23,23,23,23,24,24,24,24,25,25,25,26,26,27,27,28,28,28,28,28,29,29,29,30,30,30,30,30,30,31,31,31,31,31,32,32,32,33,33,33,33,34,34,34,35,35,35,35,35,36,36,36,36,36,37,37,38,38,38,38,39,39,40,41,41,41,43,44,45,45,47,48,49,49,50,50,50,51,53,53,55,56,56,57,59,61,61,63,69],"depth":[51,51,52,53,53,53,54,54,54,54,54,54,55,55,55,55,56,57,57,57,58,58,58,59,59,59,59,59,59,60,60,60,60,60,60,61,61,61,61,61,61,61,62,62,62,62,63,63,63,63,63,64,64,64,64,64,64,65,65,65,65,65,66,66,66,66,67,67,67,67,67,68,68,68,68,69,69,69,69,69,69,69,70,70,71,71,71,71,71,72,72,73,73,75,75,76,79,80,81],"reach":[0,0,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,16,16,16,16,16,16,16,16,16,16,16,16,20,20,20,20,20,20,20,20,20,23,23,23,23,23,23,26,26,26,28,28,28,28,28,30,30,30,30,30,32,32,32,33,33,35,36,36,36,36,36,36,37,37,38,38,39,39,40,43,43,43,45,45,46,48,48,49,50,50,51,51,51,52,53,55,59]};
|
||||
export const CARD_SAMPLE_PERCENTILES: PercentileTable = {"attention":[14,14,16,17,18,19,19,19,20,20,21,21,21,22,22,22,23,23,23,24,24,24,24,25,25,25,26,26,26,27,27,27,27,28,28,28,28,29,29,30,30,30,30,30,30,31,31,31,31,32,32,33,33,34,34,34,35,35,35,35,35,36,36,37,37,38,38,38,39,39,40,40,40,41,41,42,42,43,44,44,45,46,47,48,49,49,50,51,53,53,55,56,57,59,61,62,62,64,68],"depth":[50,51,51,53,53,54,54,54,54,54,55,55,55,56,56,57,57,57,57,57,58,58,58,58,58,58,59,59,59,59,59,60,60,60,60,61,61,61,61,61,61,62,62,62,62,62,63,63,63,63,63,64,64,64,64,64,64,65,65,65,65,65,66,66,66,66,67,67,67,67,67,68,68,68,68,69,69,69,69,69,70,70,71,71,71,72,72,72,73,73,74,75,75,76,78,78,79,80,83],"reach":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,16,16,16,16,16,16,16,16,16,16,16,16,16,20,20,20,20,20,20,20,20,23,23,23,23,23,26,26,26,26,26,28,28,28,28,30,30,30,30,30,32,32,32,33,33,33,35,36,36,36,37,38,39,40,41,43,43,44,45,45,47,49,50,50,51,52,55,55,59]};
|
||||
|
||||
export interface LoanerSnapshot {
|
||||
pageId: number; title: string; category: Faction;
|
||||
@@ -13,4 +14,4 @@ export interface LoanerSnapshot {
|
||||
}
|
||||
|
||||
/** Frozen loaner pool (§2): real snapshots of random articles, for filling deck slots and draft modes. */
|
||||
export const LOANER_SNAPSHOTS: readonly LoanerSnapshot[] = [ { "pageId": 49830722, "title": "Dicroidium odontopteroides", "category": "Nature", "stats": { "attention": 30, "depth": 55, "reach": 0 }, "trendPercent": 5.4, "dailyAverage": 1.9 }, { "pageId": 25856905, "title": "Dichromorpha viridis", "category": "Nature", "stats": { "attention": 35, "depth": 52, "reach": 23 }, "trendPercent": -43.6, "dailyAverage": 4.29 }, { "pageId": 66508497, "title": "Amanita mairei", "category": "Nature", "stats": { "attention": 30, "depth": 50, "reach": 32 }, "trendPercent": -21.8, "dailyAverage": 1.97 }, { "pageId": 4289899, "title": "Anthodon (reptile)", "category": "Nature", "stats": { "attention": 39, "depth": 66, "reach": 37 }, "trendPercent": -8.3, "dailyAverage": 7.52 }, { "pageId": 47519878, "title": "Jeanne Madden", "category": "People", "stats": { "attention": 24, "depth": 54, "reach": 23 }, "trendPercent": -40.9, "dailyAverage": 0.84 }, { "pageId": 46263191, "title": "Max Touloute", "category": "People", "stats": { "attention": 28, "depth": 67, "reach": 16 }, "trendPercent": 95.8, "dailyAverage": 1.52 }, { "pageId": 3372934, "title": "Hermes Ramírez", "category": "People", "stats": { "attention": 30, "depth": 65, "reach": 38 }, "trendPercent": -9.2, "dailyAverage": 1.9 }, { "pageId": 1374812, "title": "Tom Ewell", "category": "People", "stats": { "attention": 61, "depth": 71, "reach": 50 }, "trendPercent": -19.8, "dailyAverage": 146.71 }, { "pageId": 13799810, "title": "Levophacetoperane", "category": "Science", "stats": { "attention": 37, "depth": 61, "reach": 16 }, "trendPercent": -1.8, "dailyAverage": 5.32 }, { "pageId": 36740675, "title": "The Best of Men", "category": "Science", "stats": { "attention": 45, "depth": 63, "reach": 23 }, "trendPercent": -3.4, "dailyAverage": 15.35 }, { "pageId": 4426773, "title": "Agda (programming language)", "category": "Science", "stats": { "attention": 56, "depth": 69, "reach": 36 }, "trendPercent": 7.8, "dailyAverage": 78.68 }, { "pageId": 42770753, "title": "Château de la Faye (Villexavier)", "category": "History", "stats": { "attention": 20, "depth": 54, "reach": 10 }, "trendPercent": 7.7, "dailyAverage": 0.45 }, { "pageId": 15362336, "title": "1954 Gold Coast general election", "category": "History", "stats": { "attention": 38, "depth": 60, "reach": 16 }, "trendPercent": -10.4, "dailyAverage": 5.84 }, { "pageId": 9026000, "title": "Names of Poland", "category": "History", "stats": { "attention": 53, "depth": 71, "reach": 23 }, "trendPercent": -0.9, "dailyAverage": 46.16 }, { "pageId": 25275009, "title": "Amur Annexation", "category": "History", "stats": { "attention": 59, "depth": 70, "reach": 33 }, "trendPercent": -6.7, "dailyAverage": 104.45 }, { "pageId": 7674700, "title": "Shipley Plateau", "category": "Culture", "stats": { "attention": 23, "depth": 54, "reach": 10 }, "trendPercent": -55.1, "dailyAverage": 0.71 }, { "pageId": 15810707, "title": "Charmont-en-Beauce", "category": "Culture", "stats": { "attention": 23, "depth": 54, "reach": 51 }, "trendPercent": 27.8, "dailyAverage": 0.74 }, { "pageId": 48653101, "title": "Tornadoes of 1978", "category": "Culture", "stats": { "attention": 45, "depth": 70, "reach": 0 }, "trendPercent": 3.2, "dailyAverage": 16.48 }, { "pageId": 981340, "title": "Tatsunoko Production", "category": "Culture", "stats": { "attention": 61, "depth": 81, "reach": 43 }, "trendPercent": -9.4, "dailyAverage": 152.84 } ];
|
||||
export const LOANER_SNAPSHOTS: readonly LoanerSnapshot[] = [ { "pageId": 4961906, "title": "Chinese star maps", "category": "Space", "stats": { "attention": 44, "depth": 74, "reach": 16 }, "trendPercent": -13.6, "dailyAverage": 14.1 }, { "pageId": 78154568, "title": "Lithodes mamillifer", "category": "Nature", "stats": { "attention": 20, "depth": 53, "reach": 10 }, "trendPercent": -34.8, "dailyAverage": 0.48 }, { "pageId": 23256692, "title": "Coelogyne trinervis", "category": "Nature", "stats": { "attention": 23, "depth": 53, "reach": 30 }, "trendPercent": -42.9, "dailyAverage": 0.77 }, { "pageId": 53418112, "title": "2012 United States presidential straw poll in Guam", "category": "Nature", "stats": { "attention": 37, "depth": 65, "reach": 0 }, "trendPercent": 15.3, "dailyAverage": 5.58 }, { "pageId": 273706, "title": "Pallas's cat", "category": "Nature", "stats": { "attention": 77, "depth": 80, "reach": 65 }, "trendPercent": -0.7, "dailyAverage": 1355.65 }, { "pageId": 20139020, "title": "Samuel Yeatman", "category": "People", "stats": { "attention": 14, "depth": 56, "reach": 10 }, "trendPercent": -25, "dailyAverage": 0.19 }, { "pageId": 51796741, "title": "Alex Piquero", "category": "People", "stats": { "attention": 36, "depth": 65, "reach": 0 }, "trendPercent": -51, "dailyAverage": 4.87 }, { "pageId": 3560741, "title": "Martin Taylor (businessman)", "category": "People", "stats": { "attention": 41, "depth": 63, "reach": 20 }, "trendPercent": 1.1, "dailyAverage": 8.68 }, { "pageId": 2806760, "title": "Jess Harnell", "category": "People", "stats": { "attention": 69, "depth": 79, "reach": 45 }, "trendPercent": -2.8, "dailyAverage": 463.68 }, { "pageId": 13799810, "title": "Levophacetoperane", "category": "Science", "stats": { "attention": 37, "depth": 61, "reach": 16 }, "trendPercent": -1.8, "dailyAverage": 5.32 }, { "pageId": 36740675, "title": "The Best of Men", "category": "Science", "stats": { "attention": 45, "depth": 63, "reach": 23 }, "trendPercent": -3.4, "dailyAverage": 15.35 }, { "pageId": 4426773, "title": "Agda (programming language)", "category": "Science", "stats": { "attention": 56, "depth": 69, "reach": 36 }, "trendPercent": 7.8, "dailyAverage": 78.68 }, { "pageId": 48469081, "title": "Dr. John L. Butler House", "category": "History", "stats": { "attention": 17, "depth": 56, "reach": 0 }, "trendPercent": -23.1, "dailyAverage": 0.32 }, { "pageId": 33454946, "title": "Tydeus Painter", "category": "History", "stats": { "attention": 22, "depth": 54, "reach": 20 }, "trendPercent": -13.6, "dailyAverage": 0.61 }, { "pageId": 74291637, "title": "Pullman porter affair", "category": "History", "stats": { "attention": 39, "depth": 68, "reach": 0 }, "trendPercent": -10.4, "dailyAverage": 6.94 }, { "pageId": 15105978, "title": "Well", "category": "History", "stats": { "attention": 64, "depth": 78, "reach": 70 }, "trendPercent": -6.4, "dailyAverage": 233.77 }, { "pageId": 50869430, "title": "Felt, Not Heard", "category": "Culture", "stats": { "attention": 21, "depth": 57, "reach": 0 }, "trendPercent": -45.5, "dailyAverage": 0.58 }, { "pageId": 14761136, "title": "RBMX", "category": "Culture", "stats": { "attention": 26, "depth": 66, "reach": 10 }, "trendPercent": 21.4, "dailyAverage": 1.1 }, { "pageId": 31946653, "title": "Cody Floatplane", "category": "Culture", "stats": { "attention": 33, "depth": 65, "reach": 20 }, "trendPercent": -11, "dailyAverage": 2.87 }, { "pageId": 247636, "title": "Canadian Grand Prix", "category": "Culture", "stats": { "attention": 62, "depth": 79, "reach": 55 }, "trendPercent": 4.3, "dailyAverage": 172.23 } ];
|
||||
|
||||
Reference in New Issue
Block a user