Have ideas to improve npm?Join in the discussion! »

tournament-organizerTypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Tournament Organizer

A zero dependency module for organizing tournaments

npm GitHub last commit GitHub issues GitHub pull requests GitHub Ko-Fi

About

This JavaScript module for Node.js facilitates the organization and execution of tournaments.

Tournaments can be paired by single elimination, double elimination, round-robin, double round-robin, Swiss, and Dutch.

If round-robin, double round-robin, Swiss, or Dutch are chosen, then a single elimination or double elimination playoffs can follow.

For Swiss, Dutch, and round-robin tournaments, the following tiebreakers systems are supported:

  • Buchholz Cut 1
  • Solkoff (Buchholz)
  • Median-Buchholz
  • Sonneborn-Berger (Neustadtl)
  • Cumulative (and Cumulative Opponent's)
  • Versus
  • Magic TCG
    • Opponent's match win percentage
    • Game win percentage
    • Opponent's game win percentage
  • Pokemon TCG
    • Opponent's match win percentage
    • Opponent's opponent's match win percentage

Installation

npm install tournament-organizer

Basic Usage

const TournamentOrganizer = require('tournament-organizer');

// Create an event manager

const manager = new TournamentOrganizer.EventManager();

// Create a tournament
// First parameter can be set to a custom ID
// More options are available to set

const tourney = manager.createTournament(null, {
    name: 'My Example Tournament',
    format: 'swiss',
    playoffs: 'elim',
    cutLimit: 8,
    bestOf: 3,
    winValue: 3,
    drawValue: 1,
    tiebreakers: ['magic-tcg']
});

// Add players

tourney.addPlayer('Liam S');
tourney.addPlayer('Emma P.');
tourney.addPlayer('Noah B.');
tourney.addPlayer('Sophia R.');
// As many as desired

// Start the tournament

tourney.startEvent();

// Get all active matches

const active = tourney.activeMatches();

// Record a result

tourney.result(active[0], 2, 1);

// Get standings

const standings = tourney.standings();

Implementations

N/A

Contributing

Please submit an issue if you encounter a bug or have a feature suggestion.

If you are interested, please feel free to fork and clone the repository (on main branch), then submit a pull request.

I am a high school teacher, and would appreciate any and all support in continuing this project.

Install

npm i tournament-organizer

DownloadsWeekly Downloads

51

Version

1.0.2

License

MIT

Unpacked Size

3.98 MB

Total Files

65

Last publish

Collaborators

  • avatar