GithubHelp home page GithubHelp logo

masters's Introduction

Masters tournaments

Build Status Dependency Status

Stability: 2 - Unstable

Overview

Knockout tournaments consist of a pool of players, repeatedly fighting against each other and gradually reducing the number of players each round. We specify the number of players to knock out each round as an array of integers.

Construction

Simply specify the number of players and an array of numbers to knock out per rounds. The resulting tournament will have the same number of matches as that array's length + 1.

var ko = new Masters(10, [3, 2, 2]);

This example will create:

  • 10 player match in round 1
  • 7 player match in round 2
  • 5 player match in round 3
  • 3 player (final) match

Limits

Limits adds a way to ensure we get the top n players from the final without having to do re-matches. Set the limit: n on the third options argument to the constructor to activate this.

This will simly engage a disambiguation clause for the final match.

Match Ids

Like all tournament types, matches have an id object that contains three values all in {1, 2, ...}:

{
  s: Number, // the bracket - always 1 TODO: remove?
  r: Number, // the round number in the current bracket
  m: Number  // the match number - always 1, only one match per round TODO: remove?
}

Finding matches

All the normal Base class helper methods exist on a Duel instance. That said, knockouts are so simple you can do this very simply anyway:

var r1 = ko.findMatches({ r: 1 });
// NB: equivalent to: ko.matches[0]

var firstThreeRounds = ko.findMatchesRanged({}, { r: 3 });
// NB: equivalent to: ko.matches.slice(0, 3)

var upcomingForSeed1 = ko.upcoming(1);
var matchesForSeed1 = ko.matchesFor(1);

Scoring Matches

Call ko.hscore(id, [player0Score, player1Score, ...]) as for every match played. The ko.unscorable(id, scoreArray) will tell you whether the score is valid. Read the entry in the tournament commonalities doc.

NB: Ambiguity restriction

Masters allow for ties everywhere except between the first knocked out player and the last advancing player. In the final, ties are fully allowed, so multiple players can share the first place. Check for this if it's unsuited to your game/application.

Special Methods

None.

Caveats

None. Maybe a note that this is technically a special case of FFA eliminations.

License

MIT-Licensed. See LICENSE file for details.

masters's People

Contributors

clux avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.