Free for All
A FreeForAll
is between minPlayers
and maxPlayers
. calculate(playerIds)
determines the winning order.
Example
import { Player, FreeForAll } from 'teslo'
const match = new FreeForAll([
new Player('1', 1000),
new Player('2', 900),
new Player('3', 800)
])
const results = match.calculate(['1', '2', '3'])
/*
[
{
id: '1',
elo: 1010
},
{
id: '2',
elo: 900
},
{
id: '3',
elo: 790
}
]
*/
API
interface Options {
kFactor?: number
minPlayers?: number
maxPlayers?: number
}
class FreeForAll {
constructor(players?: Player[], options?: Options)
static create(players?: Player[], options?: Options): FreeForAll
get contestants(): Map<string, Player>
get size(): number
get completed(): boolean
addPlayer(player: Player): this
addPlayers(...players: Player[]): this
calculate(playerIds: string[]): PlayerResult[]
getResults(): PlayerResult[]
}