ecclesia
Version:
Framework for political and electoral simulations
28 lines (25 loc) • 1.01 kB
TypeScript
import { Simple } from '../ballots.js';
import { Attribution, HasNSeats } from './base.js';
import '@gouvernathor/python/collections';
/**
* Creates an attribution method in which
* the party with the most votes wins all the seats.
*
* Will throw an AttributionFailure error if no party wins any vote.
*/
declare function plurality<Party>({ nSeats }: {
nSeats: number;
}): Attribution<Party, Simple<Party>> & HasNSeats;
/**
* Creates an attribution method in which a candidate needs to reach
* a certain percentage of the votes in order to win all the seats.
*
* If not party reaches the threshold, the contingency attribution method is called,
* or if no contingency is provided, an AttributionFailure error is thrown.
*/
declare function superMajority<Party>({ nSeats, threshold, contingency }: {
nSeats: number;
threshold: number;
contingency?: Attribution<Party, Simple<Party>> | null;
}): Attribution<Party, Simple<Party>> & HasNSeats;
export { plurality, superMajority };