bracket-possibilities
Get the best possible outcomes for a bracket based on a partially complete master bracket.
Install
npm install bracket-possibilities --save
API / Usage
Make a new bracket-possibilities
instance with an options object (the year and sport options are required and passed directly to bracket-data
):
const p = sport: 'ncaam' year: '2016' // Hey its my entry from 2016 and the actual completed games through the Sweet 16const entries = const findEntry = userusername === 'lukekarrys'const entry = entriesbracketconst master = 'S19513113721532XXXW181241131021432XXXE1954614721567XXXMW191241131015141110XXXFFXXX' // This will return the best possible future bracket for 'entry' with any unwinnable// games (meaning the entry has an eliminated team winning) replaced with 'X'p// S195131137215321X1W181241131021432X22E19546147215671X1MW191241131015141110XXXFFSXS // If 'entry' gets every game correct that it can, this would be its scorep// 1240 // This will return an array of all possible bracket combinations based on the entry's best possible// bracket. In this instance the entry had 7 unwinnable games, so there will be 128 (2^7)// possibilities. Warning: the more incorrect picks the longer this will takep// [ ... ] (128 different brackets) // This will return the first possible winning outcome for the entry matched by `findEntry`// Unfortunately, for me this will return null in this case because I was eliminated by the Sweet 16p// null or something like { rank: 1, bracket: 'SOME WINNING BRACKET' } // This will return some of the `possibilities` where the entry matched by `findEntry`// will finish in 1st place (tied or not)p// [{ rank: 1, bracket: 'OUTCOME1' }, { rank: 1, bracket: 'OUTCOME2' }, ...] // This will return all of the `possibilities` where the entry matched by `findEntry`// will finish in 1st place (tied or not). The difference between `winners` is that// method will short circuit some outcomes by only trying games where the entry// does not have an elimiated team winningp// [{ rank: 1, bracket: 'OUTCOME1' }, { rank: 1, bracket: 'OUTCOME2' }, ...] // Find all top 5 finishes for the entry matched by `findEntry`p// [{ rank: 3, behind: 100, bracket: 'OUTCOME1' }, { rank: 4, behind: 120, bracket: 'OUTCOME2' }, ...]// behind is how many points the entry would be behind the eventual winner // Pass `scoreType` to any method involving scoring to use a different scoring// system for the end result. Eg, find the best possible score using the gooley// scoring systemp
LICENSE
MIT