Skip to content

Track scores, dealer rotations, and wind positions. Supports full/shared gun scoring and faan-based point calculations.

License

Notifications You must be signed in to change notification settings

byalextran/mahjong-scorekeeper

Repository files navigation

Mahjong Scorekeeper

Tests

View Demo

A web app for scorekeeping Cantonese/Hong Kong-style Mahjong games with support for:

  • Full and shared gun scoring
  • Self-drawn win scoring
  • Faan-based point calculation
  • Wind position and dealer tracking
  • Score history
  • Dice rolling
  • Browser storage for game data

Scoring

Points are determined by faan count (see faan-to-points table below). Points are paid depending on win type:

  • Self-drawn: Each of the three losers pays the self-draw amount to the winner.
  • Discard (Full Gun): The discarder pays the full discard amount.
  • Discard (Shared Gun): The discarder pays half. the other two players split the remaining half.
Faan Self-Drawn Discard
1 2 4
2 4 8
3 8 16
4 16 32
5 32 64
6 48 96
7 64 128
8 96 192
9 128 256
10 192 384
11 256 512
12 384 768
13 512 1024

Feature or Variation Request

I built this for my uncle with his input, but I don't know much about the game. From what I gather, there are other common variations and/or house rules.

If you have a feature request or a variation you'd like supported, please let me know by submitting an issue!

Deploy to Cloudflare Pages

Only needed if you want to make modifications and host the app yourself. The latest version will always be available at mahjong.alextran.org.

Prerequisites

Before installing this project, make sure you have the following installed:

Clone Repo

git clone https://github.com/byalextran/mahjong-scorekeeper.git
cd mahjong-scorekeeper

After making changes, run the test suite to confirm all tests still pass.

Authenticate With Cloudflare

wrangler login

Follow the link/instructions to authenticate.

Install Dependencies

npm install

Deploy to Cloudflare

npm run deploy

If deploying for the first time, follow the prompts.

Run Test Suite

Core game logic is covered by unit and integration tests.

npm run test:run

Update App

Make sure you're in the mahjong-scorekeeper directory and run:

git pull
npm install

When you're ready to deploy again, run npm run deploy.

About

Track scores, dealer rotations, and wind positions. Supports full/shared gun scoring and faan-based point calculations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •