Duel
A Duel
is between 2 players. calculate(playerId)
determines the winner.
Example
import { Player, Duel } from 'teslo'
const match = new Duel([new Player('1', 1000), new Player('2', 900)])
const results = match.calculate('1')
/*
[
{
id: '1',
elo: 1012
},
{
id: '2',
elo: 888
}
]
*/
API
interface Options {
kFactor?: number
}
class Duel {
constructor(players?: Player[], options?: Options)
static create(players?: Player[], options?: Options): Duel
get contestants(): Map<string, Player>
get size(): number
get completed(): boolean
addPlayer(player: Player): this
addPlayers(...players: Player[]): this
calculate(playerId: string): PlayerResult[]
getResults(): PlayerResult[]
}