Team Duel
A TeamDuel
is between 2 teams. calculate(teamId)
determines the winner.
Example
import { Player, Team, TeamDuel } from 'teslo'
const match = new TeamDuel([
new Team('1', [new Player('1', 1000), new Player('2', 900)]),
new Team('2', [new Player('3', 800), new Player('4', 700)])
])
const results = match.calculate('1')
/*
[
{
id: '1',
players: [
{
id: '1',
elo: 1006
},
{
id: '2',
elo: 909
}
]
},
{
id: '2',
players: [
{
id: '3',
elo: 791
},
{
id: '4',
elo: 694
}
]
}
]
*/
API
interface Options {
kFactor?: number
}
class TeamDuel {
constructor(teams?: Team[], options?: Options)
static create(teams?: Team[], options?: Options): TeamDuel
get contestants(): Map<string, Team>
get size(): number
get completed(): boolean
addTeam(team: Team): this
addTeams(...teams: Team[]): this
calculate(teamId: string): TeamResult[]
getResults(): TeamResult[]
}