UNPKG

ecclesia

Version:

Framework for political and electoral simulations

27 lines (24 loc) 999 B
import { Scores } from '../ballots.js'; import { Attribution, HasNSeats } from './base.js'; import '@gouvernathor/python/collections'; /** * Creates an attribution method in which all the seats go to the candidate with the highest average score. * * The ballots are not required to grade all the candidates. */ declare function averageScore<Party>({ nSeats }: { nSeats: number; }): Attribution<Party, Scores<Party>> & HasNSeats; /** * Creates an attribution method in which all the seats go to the candidate with the highest median score. * * If there is a tie, the contingency method is called on the candidates that are tied. * The default contingency is to take the maximum average score. * * The ballots are not required to grade all the candidates. */ declare function medianScore<Party>({ nSeats, contingency }: { nSeats: number; contingency?: Attribution<Party, Scores<Party>>; }): Attribution<Party, Scores<Party>> & HasNSeats; export { averageScore, medianScore };