Closed czlee closed 10 years ago
Thinking out loud:
General principles:
Random
Manual
Power-paired
points
attribute. We use points
to generate brackets. We don't care about how the subranks were derived.Break round
All teams and standings lists are any iterable of objects with the attributes listed below. For draw types where teams are ordered, lists are assumed to be ordered from first to last. No other assumptions are made about the objects. It is illegal for a higher-ranked team to have fewer points than a lower-ranked team.
The attributes that teams must implement are:
points
, the number of wins a team is on.aff_count
. If side balancing is turned off, the order in which teams of a single pairing are presented is random.same_institution
, a function taking one argument that returns True
if and only if the team and the team provided are from the same institution, and seen_institution
, a function taking no arguments returning an integer count of how many times (prior to this round) they have seen their own institution.seen
, a function taking one argument, another team, and returning an integer count of how many times (prior to this round) they have seen their own team.Options for power-pairing rounds (other than history/institution limits) can be a string or a function. If it's a string, it refers to one of the built-in methods. If it's a function, the algorithm uses that function (and it must conform to the same specifications). Can be specified as keyword arguments to the constructor, but don't have to be. Defaults are those used at Australs.
The history and institution limits are always integers.
The draw will be communicated as a list of Debate
objects. Debate
objects are not the same as the Debate Django model (the name might cause some confusion). Each Debate
object has the following attributes:
teams
, the list of teams in the debateaff_team
, which will be the first object in the list of teamsneg_team
, which will be the second object in the list of teamsbracket
, a number, not necessarily an integer (could have intermediate bubbles). Will be returned as an integer if it can be, but may be a float.
room_rank
, an integer. A strict order of rooms.
flags
, a list of constants.
There is no guarantee that all teams are included (in fact, for break rounds, they certainly won't).
This is basically done, but I didn't implement break rounds because they're hard. Hopefully what's there now is a good framework for doing so though.
Follows from #60.
The draw algorithms currently use a number of functions that pass around lists of tuples
[(team1, team2), (team3, team4), ...]
. While fit for the purpose of creating a draw, it's not very good at tracking flags and brackets and similar information. It would be nicer to have a draw generation architecture that can remember when it performs actions like swapping or balancing affs, so that that information can be displayed to a curious (or untrusting) user, and that is generally more extensible so it's easy to generate break rounds and so on. For example, draw algorithm classes might:By "(relatively) custom", I meant that options and flags shouldn't be constrained by the architecture - they should be stored in an
.options
or.flags
attribute or something.This is probably a major job, and is probably not too high priority, since the current code does get the draw done fine (when it's not polluted by unconfirmed ballots). But it'd also be really nice to have in place for the unit tests in #71, and certainly it would give a lot more peace of mind at Australs.