Skip to content

Commit

Permalink
Country support
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Nov 4, 2023
1 parent 866dad9 commit 2e131c8
Show file tree
Hide file tree
Showing 52 changed files with 185 additions and 31 deletions.
2 changes: 2 additions & 0 deletions generate_maps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ function GenerateCountryMap {

# provinces speaking Telugu, Kannada, Tamil
# GenerateProvinceMap "LambsAndTigers" @("IN-AP", "IN-TG", "IN-KA", "IN-TN") -offset 200

# GenerateCountryMap "Horseshoe" @("MY", "MN", "CN", "KR", "TH", "IN")
37 changes: 36 additions & 1 deletion src/games.11ty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type RenderableGame = {
titleLang?: string,
originalTitle?: string,
draft?: boolean,
countries?: string,
};

function renderGames(allGames: RenderableGame[]) {
Expand Down Expand Up @@ -71,6 +72,12 @@ function renderGames(allGames: RenderableGame[]) {
allGames = allGames.filter(g => g.equipment === equipmentS);
}

// Filter country
const countryS = params.get('country');
if (countryS && countryS !== 'any') {
allGames = allGames.filter(g => g.countries && g.countries.indexOf(countryS) >= 0);
}

dest.replaceChildren(...allGames.map(g => {
const li = document.createElement("li")
if (g.variant) {
Expand Down Expand Up @@ -110,6 +117,7 @@ export function render(this: Context, data: Data) {
originalTitle: g.data.originalTitle,
players: expandPlayers(g.data.title, g.data.players),
equipment: g.data.equipment,
countries: g.data.countries,
},
...(g.data.subgames || []).map(sg => ({
title: sg.title,
Expand All @@ -118,6 +126,7 @@ export function render(this: Context, data: Data) {
originalTitle: sg.originalTitle,
players: expandPlayers(sg.title, sg.players || g.data.players),
equipment: sg.equipment || g.data.equipment,
countries: sg.countries || g.data.countries,
url: g.url + "#" + (sg.slug || slug(sg.title)),
variant: true,
}))
Expand All @@ -132,9 +141,22 @@ export function render(this: Context, data: Data) {
}
}

const countries = new Set<string>();
for (const g of expandedGames) {
if (g.countries) {
for (const c of g.countries.split(',')) {
countries.add(c);
}
} else {
console.warn(`no countries for ${g.title}`);
}
}

const collator = new Intl.Collator('en', { sensitivity: 'base', numeric: true });
const countryNames = new Intl.DisplayNames(["en"], { type: "region" });

const sortedEquipment = [...equipment.values()].sort(collator.compare);
const sortedCountries = [...countries.values()].sort((x, y) => collator.compare(countryNames.of(x)!, countryNames.of(y)!));

expandedGames.sort((x, y) => x.title.localeCompare(y.title, 'en'));

Expand Down Expand Up @@ -165,10 +187,12 @@ export function render(this: Context, data: Data) {
window.addEventListener('DOMContentLoaded', () => {
handleSelect(document.getElementById('player-select'), 'players');
handleSelect(document.getElementById('equipment-select'), 'equipment');
handleSelect(document.getElementById('country-select'), 'country');
renderGames(GAMES);
});
</script>`;


return '<h2>Filters</h2>'
+ '<form>'

Expand Down Expand Up @@ -197,7 +221,18 @@ export function render(this: Context, data: Data) {
+ '<div class="col-sm-10">'
+ '<select id="equipment-select" class="form-control">'
+ '<option selected>any</option>'
+ sortedEquipment.map(e => `<option>${e}</option>`).join('')
+ sortedEquipment.map(x => `<option>${x}</option>`).join('')
+ '</select>'
+ '</div>'
+ '</div>'
+ '</form>'

+ '<div class="form-group row mt-2">'
+ '<label for="country-select" class="col-sm-2 col-form-label">Country:</label>'
+ '<div class="col-sm-10">'
+ '<select id="country-select" class="form-control">'
+ '<option selected>any</option>'
+ sortedCountries.map(x => `<option value="${x}">${countryNames.of(x)}</option>`).join('')
+ '</select>'
+ '</div>'
+ '</div>'
Expand Down
3 changes: 2 additions & 1 deletion src/games/achi/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: Achi
titleLang: ee
equipment: Stones
equipment: Simple
countries: GH,NG
players: 2
---

Expand Down
1 change: 1 addition & 0 deletions src/games/balik-satu/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ titleLang: ms
players:
min: 2
max: 14
countries: SG,MY
equipment: Playing cards (Ceki)
subgames:
- title: Balik Lima Belas
Expand Down
3 changes: 3 additions & 0 deletions src/games/cee-lo/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
title: Cee-Lo
players: banking
countries: CN,US
subgames:
- title: Chinchirorin
titleLang: ja-Latn
countries: JP
originalTitle: <span lang="ja">チンチロリン</span>
- title: Underground Chinchirorin
countries: JP
equipment: Dice
---

Expand Down
1 change: 1 addition & 0 deletions src/games/chuck-a-luck/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Chuck-a-Luck
mainImage: chuk-a-luck_bank_club_reno_nevada.jpg
countries: US
players: banking
hero:
image: 'Potter_GrandHazard.jpeg'
Expand Down
1 change: 1 addition & 0 deletions src/games/chuhong/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ titleLang: cmn-Latn-pinyin
originalTitle: <span lang="zh">除紅</span>
equipment: Dice
players: any
countries: CN
mainImage: instructions.png
---

Expand Down
1 change: 1 addition & 0 deletions src/games/cribbage/cribbage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ title: Cribbage
draft: true
players: 2
equipment: Playing cards (Standard)
countries: UK,AU,US,NZ
---
2 changes: 2 additions & 0 deletions src/games/crown-and-anchor/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
title: Crown & Anchor
mainImage: 'CA_StGeorge.jpg'
players: banking
countries: IN,NP,CN,AU,GB,VN,TH,LA,ID,MM,MY,BN,JM,BM,NZ,CA,KH,MG,BT,BD
hero:
image: 'CA_StGeorge.jpg'
subgames:
- title: Grasping Eight
originalTitle: <span lang="yue">八㪥</span>
equipment: Dice
countries: CN
equipment: Dice (non-standard)
---

Expand Down
1 change: 1 addition & 0 deletions src/games/dama/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Dǎ Mǎ
titleLang: cmn-Latn-pinyin
originalTitle: <span lang="zh">打馬</span>
draft: true
countries: CN
---

See: @HorseCoins, @BoardGamesInLateImperialChina
1 change: 1 addition & 0 deletions src/games/eight-faces/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Eight Faces
mainImage: pek-bin.svg
players: banking
countries: CN,MY,SG
originalTitle: <span lang="zh">八面</span>
---

Expand Down
1 change: 1 addition & 0 deletions src/games/fan-tan/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Fan-Tan
originalTitle: <span lang="yue">番攤</span>
draft: true
countries: US,UK,NZ,AU,HK,CN,TH,MY,SG,PH,MO
---

<p class="lead">
Expand Down
9 changes: 7 additions & 2 deletions src/games/horseshoe/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
---
title: Horseshoe
players: 2
equipment: Stones
equipment: Simple
countries: CN,IN,KR,TH,MN,MY
---

{% image src="../../maps/Horseshoe.svg" alt="" position="aside" %}
Countries mentioned in this article.
{% imageEnd %}

<p class="lead">
This is a simple blocking game for children that seems to originate from China, where it is known by many names. Because the board is shaped like the Chinese character ‘<span lang="zh">区</span>’ (‘area’), it is known as ‘<code>区</code> character game’ (<span lang="zh" class="aka">区字棋</span>, Mandarin: <span lang="cmn-Latn-pinyin" class="aka">qū zì qí</span>). Other names include ‘crotch game’ (<span lang="zh-Hant" class="aka">褲襠棋</span>/<span lang="zh-Hans" class="aka">裤裆棋</span>, Mandarin: <span lang="cmn-Latn-pinyin" class="aka">kùdāng qí</span>), or ‘scissor game’ (<span lang="zh" class="aka">剪刀棋</span>, Mandarin: <span lang="cmn-Latn-pinyin" class="aka">jiǎndāo qí</span>).
</p>
Expand All @@ -23,7 +28,7 @@ In Cantonese it is called ‘cleft lip game’ (<span lang="yue" class="aka">崩

In Korea it is known as <span lang="ko-Latn" class="aka">umulgonu</span> (<span lang="ko" class="aka">우물고누</span> ‘well game’) or <span lang="ko-Latn" class="aka">ganggonu</span> (<span lang="ko" class="aka">강고누</span> ‘river game’).[@KoreanGames p. 100] In Thailand it is called <span lang="th-Latn" class="aka">suea tok thang</span> (<span lang="th" class="aka">เสือตกถัง</span> ‘tiger falls into the bucket’),{%fn%}Older books transliterate this as <span lang="th-Latn" class="aka">sua tok tong</span>.{%endfn%} or <span lang="th-Latn" class="aka">saeng tawan</span> (<span lang="th" class="aka">แสงตะวัน</span> ‘sun rays’).[@TigerTank]{%fn%}Another name given is <span lang="th" class="aka">จะบูมูลู</span> but I haven’t been able to translate it.{%endfn%} In Malaysia it is known as {% pronounce lang="ms" class="aka" word="telaga buruk" pronouncer="Alvin00" %} (‘bad well’).[@TigerTank]

<div class="multi">
<div class="multi equal">

{% image src="Korean_board.svg" alt="" %}
A Korean board, after @KoreanGames [p. 100].
Expand Down
1 change: 1 addition & 0 deletions src/games/in-and-in/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: In and In
players: [2,3]
equipment: Dice
countries: UK
---

<p class="lead">
Expand Down
1 change: 1 addition & 0 deletions src/games/kartu-lima/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Kartu Lima
countries: ID
titleLang: jav-Latn
draft: true
players:
Expand Down
3 changes: 3 additions & 0 deletions src/games/kings/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
---
title: Kings
equipment: Playing cards (Standard)
countries: PG
subgames:
- title: Thothit Yogyakarta
titleLang: jav-Latn
players: 3
countries: ID
equipment: Playing cards (Ceki)
- title: Thit-Thit-Dulit
titleLang: jav-Latn
players: 2
countries: ID
equipment: Playing cards (Ceki)
---

Expand Down
1 change: 1 addition & 0 deletions src/games/koa/koa.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Koa
titleLang: jav-Latn
equipment: Playing cards (Ceki)
countries: ID
draft: true
---

Expand Down
1 change: 1 addition & 0 deletions src/games/konane/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Kōnane
titleLang: haw
players: 2
countries: US
---

<p class="lead"><span class="noun" lang="haw">Kōnane</span> (sometimes also called <span
Expand Down
3 changes: 1 addition & 2 deletions src/games/laugh-and-lie-down/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
title: Laugh and Lie Down
players: [4, 5]
equipment: Playing cards (Standard)
countries: UK
---

<p class="lead">
Laugh and Lie Down is a {% a fishing-games, fishing game %} for five (or four) players from the 17th century.{%fn%}By 1784 it was being described as “old-fashioned”.[@ObservationsOnSomeOldFashionedGames p. 134]{%endfn%} The only known description of this game is from Francis Willughby’s <cite>Book of Games</cite>.[@FrancisWillughby p. 138]
</p>

<!-- excerpt -->

## Play

The game is played using a standard deck of 52 cards. The standard game is for five players.
Expand Down
1 change: 1 addition & 0 deletions src/games/len-suea/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: Len Suae
titleLang: th-Latn
originalTitle: <span lang="th">เล่นเสือ</span>
draft: true
countries: TH
---

Tiger game, often transcribed "Len Choa" in old books???[@OnSiameseLiterature p. 380]
1 change: 1 addition & 0 deletions src/games/liubo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ originalTitle: <span lang="zh">六博</span>
draft: true
players: 2
equipment: Board game
countries: CN
---


Expand Down
1 change: 1 addition & 0 deletions src/games/mehen/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Mehen
draft: true
originalTitle: <img src="/small-images/mehen.svg" alt="𓅓𓐱𓎛𓐰𓈖𓏌" class="inline-img" lang="egy" />
countries: EG
---

NB: despite the image of Rashepses tomb by Lepsius {include this from senet
Expand Down
3 changes: 2 additions & 1 deletion src/games/morabaraba/morabaraba.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
title: Morabaraba
titleLang: st
players: 2
equipment: Stones
equipment: Simple
countries: ZA,LS,BW,MZ,SZ
mainImage: '16908233_1262123897217460_4095342219718819840_n.jpg'
hero:
image: '16908233_1262123897217460_4095342219718819840_n.jpg'
Expand Down
10 changes: 8 additions & 2 deletions src/games/morra/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ title: Morra
titleLang: it
players: 2
draft: true
countries: IT
hero:
image: morra.jpg
license: cc0
author: Bartolomeo Pinelli
equipment: None
subgames:
- title: Caai¹ Mui⁴⁻²
titleLang: yue-Latn-jyutping
countries: CN,HK
originalTitle: 猜枚
---

In English, this game is usually known by its Italian name of “<span class="aka" lang="it">morra</span>”.[@MacedonianFolklore p. 297] In Latin it was known as <span lang="la" class="aka">micatio</span>[@StudyOfGames p. 65] or <span lang="la" class="aka">micare digitis</span>.[@IlGiuocoDellaMorra]
Expand Down Expand Up @@ -35,9 +41,9 @@ Arabic: Lane says: خَرَاجِ / خراج ‘khrāj’, or خَرِيجٌ: ht

Ge'ez: see @ComparativeGeez [p. 168]

## Chinese games
## <span lang="yue-Latn-jyutping" class="aka">Caai¹ Mui⁴⁻²</span> (<span lang="yue" class="aka">猜枚</span>)

Called <span lang="yue" class="aka">猜枚</span>[@TipcatAndOtherChineseGames] <span lang="yue-Latn-jyutping" class="aka">caai¹ mu⁴⁻²</span>{%fn%}In very old works this is represented as <span lang="yue-Latn" class="aka">Tsoey-Moey</span>[@MicatioDigitorumDescribed], <span lang="yue-Latn" class="aka">Tsae Mei</span>,[@IuKiaoLi p. 284] or <span lang="yue-Latn" class="aka">chái-múí</span>.[@ThingsChinese p. 296]{%endfn%} ‘guess the count’, <span lang="yue" class="aka">猜碼</span>[@AFunSouthernChineseGame] <span class="aka" lang="yue-Latn-jyutping">caai¹ maa⁵</span> ‘guess the number’, or <span lang="yue" class="aka">猜拳</span>[@TonicDictionary p. 191] <span lang="yue-Latn-jyutping" class="aka">caai¹ kyun⁴</span> ‘guess the fist’ in Cantonese. A variant using two hands where a hand can only be open or shut is also called “15,20”, or “15,15,…” <span lang="zh" class="aka">十五二十</span>, and the player must guess correctly twice.[@ShiwuShiwu]
Called <span lang="yue" class="aka">猜枚</span>[@TipcatAndOtherChineseGames] <span lang="yue-Latn-jyutping" class="aka">caai¹ mui⁴⁻²</span>{%fn%}In very old works this is represented as <span lang="yue-Latn" class="aka">Tsoey-Moey</span>[@MicatioDigitorumDescribed], <span lang="yue-Latn" class="aka">Tsae Mei</span>,[@IuKiaoLi p. 284] or <span lang="yue-Latn" class="aka">chái-múí</span>.[@ThingsChinese p. 296]{%endfn%} ‘guess the count’, <span lang="yue" class="aka">猜碼</span>[@AFunSouthernChineseGame] <span class="aka" lang="yue-Latn-jyutping">caai¹ maa⁵</span> ‘guess the number’, or <span lang="yue" class="aka">猜拳</span>[@TonicDictionary p. 191] <span lang="yue-Latn-jyutping" class="aka">caai¹ kyun⁴</span> ‘guess the fist’ in Cantonese. A variant using two hands where a hand can only be open or shut is also called “15,20”, or “15,15,…” <span lang="zh" class="aka">十五二十</span>, and the player must guess correctly twice.[@ShiwuShiwu]

On the 5th of April, 1872, the Nuisances Ordinance of Hong Kong (No. 2 of 1872) placed restrictions upon the game:{%fn%}This was later integrated as part of the Summary Offences Ordinance.[@LawAndRacism p. 248][@SummaryOffencesHongKong]{%endfn%}

Expand Down
5 changes: 2 additions & 3 deletions src/games/mu-torere/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
title: Mū Tōrere
titleLang: mi
players: 2
equipment: Stones
equipment: Simple
countries: NZ
---

<p class="lead">
<span lang="mi" class="noun aka">Mū Tōrere</span> is a traditional Maōri blocking game from New Zealand.
</p>

<!-- excerpt -->

The game was first described in print by @Best17, and this description is based upon his.

It is said that the [Ngāti Haua](https://en.wikipedia.org/wiki/Ng%C4%81ti_Hau%C4%81) chief [Wiremu Tamihana Te Waharoa](https://en.wikipedia.org/wiki/Wiremu_Tamihana) once offered to play <span lang="mi" class="noun">Mū Tōrere</span> with [Governor Grey,](https://en.wikipedia.org/wiki/George_Grey) with the whole country as a stake — Grey apparently declined.[@TaongaTukuIho p. 54]
Expand Down
3 changes: 2 additions & 1 deletion src/games/my-ladys-hole/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: My Lady’s Hole
draft: true
equipment:
equipment: Playing cards (Standard)
countries: UK
---

This article is about the card game; the term could also be used to refer to {%
Expand Down
1 change: 1 addition & 0 deletions src/games/my-sow-pigged/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: My Sow (Has) Pigged
equipment: Playing cards (Standard)
countries: UK
---

<p class="lead">
Expand Down
3 changes: 2 additions & 1 deletion src/games/nine-mens-morris/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
title: Nine Men’s Morris
mainImage: DSCF0525.jpg
players: 2
equipment: Stones
equipment: Simple
countries: CN,UK,US,NZ,AU,DE,FR,BD,GR,IN,KR,TR,CH,PK,LK,ES,IT
subgames:
- title: Lasker Morris
- title: Twelve Men’s Morris
Expand Down
Loading

0 comments on commit 2e131c8

Please sign in to comment.