npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

miaoda-game-gou-ji-rules

v0.2.0

Published

Complete Pagat Qingdao Gou Ji match rules with tribute, duels, special play, scoring, and safe views.

Readme

miaoda-game-gou-ji-rules

Immutable, engine-neutral rules for fixed six-player Qingdao Gou Ji profile pagat-qingdao-main-complete-match-v1: opening claims, revolution, tribute/return, opposite-seat duels, Shao Pai, Rang Pai, endgame order, placements, and cumulative team scoring.

pnpm add miaoda-game-gou-ji-rules

Run a match

import {
  applyGouJiAction,
  createGouJiGame,
  createGouJiPlayerView,
} from 'miaoda-game-gou-ji-rules';

let state = createGouJiGame({
  playerOrder: ['a', 'b', 'c', 'd', 'e', 'f'],
  seed: 2026,
});
const playerId = state.playerOrder[0];
const view = createGouJiPlayerView(state, playerId);
if (view.legalActions.canClaimOpeningLead) {
  const result = applyGouJiAction(state, { type: 'claim-opening-lead', playerId });
  if (result.ok) state = result.state;
}

Render commands only from legalActions. Use suggestedPlays for ready-made selections and playConstraint for manual physical-card selection; every submitted action is revalidated. Do not derive tribute strength, response eligibility, Shao Pai order, Rang Pai seats, or endgame order in UI code.

Public events

import { projectGouJiEvents } from 'miaoda-game-gou-ji-rules';

if (result.ok) {
  broadcast(projectGouJiEvents(result.events, playerId, result.state));
}

The projector returns detached, explicitly rebuilt events. Tribute and return events contain only the obligation, players, and card count; exchanged card ids stay private. A Shao Pai declaration contains only its group count. Card ids become public only in cards-played or shao-pai-advanced after those groups are actually played. Settlement records accept only the six committed player ids, and unknown runtime event types throw instead of being forwarded.

Restore a snapshot

import { restoreGouJiState } from 'miaoda-game-gou-ji-rules';

state = restoreGouJiState(JSON.parse(savedJson));

Restore verifies seed, deal evidence, and accepted-action replay provenance before returning a detached snapshot. Use validateGouJiState for a non-throwing result. Keep authoritative hands, deck order, tribute card ids, pending Shao Pai groups, seed, and action history on a trusted host; clients receive only their player view and projected events. GOU_JI_ZH_CN_LABELS provides optional default UI copy.