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 🙏

© 2024 – Pkg Stats / Ryan Hefner

autodndtable

v0.1.0

Published

Assign players to TTRPG tables based on tiers and required/ forbidden people combinations

Downloads

1

Readme

autodndtable

About

Assign players to TTRPG tables based on tiers and required/ forbidden people combinations

Prerequisites

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Getting Started

Installation

As a node package

  1. Add the package to your package.json file:

    npm install autodndtable
  2. Include the package in your javascript

    const autodndtable = require("autodndtable");

As a <script>

  1. Add <script>-tag to your HTML:

    <script src="https://cdn.jsdelivr.net/npm/autodndtable@latest/dist/bundle.js"></script>

Usage

Create the "accounts" json

[
	{
		"uuid": "Alice",
		"tiers": ["1"],
		"match_with": ["Charlie"],
		"dont_match_with": []
	},
	{
		"uuid": "Bob",
		"tiers": ["2"],
		"match_with": [],
		"dont_match_with": []
	},
	{
		"uuid": "Charlie",
		"tiers": ["1", "2"],
		"match_with": [],
		"dont_match_with": []
	}
]

| key | type | value | | :---: | :---: | :---: | | uuid | string | A unique identifier for the person. Can be a username, email or unique id | | tiers | array(string|integer) | The tiers in which this person wishes to play | | match_with | array(string) | The uuid of other people to which this player MUST be paired by the script | | dont_match_with | array(string) | The uuid of other people to which this player MUST NOT be paired by the script |

Create the "tables" json

[
	{
		"dm_uuid": "Hannah",
		"tiers": ["1"],
		"players_uuid": [],
		"match_with": [],
		"dont_match_with": ["Alice"],
		"max_players": 3
	},
	{
		"dm_uuid": "Isaac",
		"tiers": ["2"],
		"players_uuid": [],
		"match_with": [],
		"dont_match_with": [],
		"max_players": 3
	},
	{
		"dm_uuid": "Julia",
		"tiers": ["1", "2"],
		"players_uuid": [],
		"match_with": [],
		"dont_match_with": [],
		"max_players": 3
	}
]

| key | type | value | | :---: | :---: | :---: | | dm_uuid | string | A unique identifier for the person. Can be a username, email or unique id | | tiers | array(string|integer) | The tiers in which this DM can run a table | | players_uuid | array(string|integer) | The uuid of players assign to this table. This array MUST be declared but empty. It will be filled by the script. | | match_with | array(string) | The uuid of other people to which this DM MUST be paired by the script | | dont_match_with | array(string) | The uuid of other people to which this DM MUST NOT be paired by the script | | max_players | integer | The maximum number of players that can be assigned to this table by the script |

Run the script

//include the script from node_modules
const autodndtable = require("autodndtable");

//See Usage#Create the "accounts" json for structure
let accounts = [{uuid:"Alice",tiers:["1"],match_with:["Charlie"],dont_match_with:[]},{uuid:"Bob",tiers:["2"],match_with:[],dont_match_with:[]},{uuid:"Charlie",tiers:["1","2"],match_with:[],dont_match_with:[]}];

//See Usage#Create the "tables" json for structure
let tables=[{dm_uuid:"Hannah",tiers:["1"],players_uuid:[],match_with:[],dont_match_with:["Alice"],max_players:3},{dm_uuid:"Isaac",tiers:["2"],players_uuid:[],match_with:[],dont_match_with:[],max_players:3},{dm_uuid:"Julia",tiers:["1","2"],players_uuid:[],match_with:[],dont_match_with:[],max_players:3}];

//Create the arrangement
//Will return null if no arrangement can be found
let arrangement = autodndtable.tryToFindArrangement(accounts, tables);

//Write the output to console
console.log(JSON.stringify(arrangement, false, "\t"))

License

This project is licensed under the MIT License. See the LICENSE file for details.