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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pighole

v1.0.2

Published

A Pighole game library

Downloads

6

Readme

Pighole Game Library

This is a simple functional game library for the game "Pighole Big Hole" for 2-6 players.

How To Play

  • 60 pigs are equally distributed to the players
  • The first player with 0 pigs wins the game
  • In round 1 every player rolls the dice exactly once
    • In round 2 every players roll the dice exactly twice
    • In round 3 every player can roll as often as he likes to until he decides it's the next players turn or he has to take pigs
  • Rolling 1-5 the player has to place one of his pigs on the respective field (1-5)
    • Rolling a 6 the player can remove on of his pigs without putting it on a field
  • Every field can hold a specific amount of pigs: Field 1 has a maximum of 1, field 2 a maximum of 2 etc. until 5. There is no field for 6
  • If a player rolls a field that is already full, he has to take all the pigs on that field and it's the next players turn

How to use this library

Start a new game

startGame(numberOfPlayers: number): GameState

This will return a new initial game state with the number of players defined

Play a turn

playTurn()(state: GameState): GameState

Set next player

After the third round every player can roll as often as he likes to. But he also has the option to not roll.

nextPlayer()(state: GameState): GameState

Game State

The game state looks as follows

export interface GameState {
    players: Player[];
    currentPlayer: number;
    fields: Field[],
    round: number,
    turns: number,
    winner: number | null,
    history: Turn[]
}

export interface Player {
    pigs: number
}

export interface Field {
    amount: number;
    max: number;
}

export interface Turn {
    player: number;
    rolled: number;
    pigs: number;
}

Winner

If a winner is found the winner property of the game state is set to the players index that won