Documentation
¶
Overview ¶
Package stats answers questions about results that have already been agreed: who beat whom, and how much table tennis the office has actually played.
No database, no HTTP, plain values only — the same separation ttr, match, standings and tournament keep (CLAUDE.md, "Konventionen").
Counts, not rates ¶
Everything here is a count or a total, and that is a decision rather than a starting point. With fewer than twenty matches on record a percentage is noise wearing a percent sign: "100% against Bodo" out of two matches is an anecdote formatted as a finding, and it gets believed because of the formatting. Counts do not have that problem — three wins to one is three wins to one whether the office has played twenty matches or two thousand.
The rate-based figures — win rate, set rate, deciding-set record — are catalogued in issue #121 and wait for the volume that makes them true.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Cell struct {
// Won and Lost are confirmed matches only. A result nobody has agreed to
// is not a result, the same rule the ranking and the tournament table
// apply.
Won, Lost int
// Self marks the diagonal, where a player meets themselves. It is a cell
// that exists for the layout and holds nothing.
Self bool
}
Cell is one player's record against one other player.
type Row ¶
type Row struct {
PlayerID uuid.UUID
Cells []Cell
// Won and Lost are the row's totals, so the matrix can carry the record
// it already implies rather than making the reader add it up.
Won, Lost int
}
Row is one player's line of the matrix.
func Matrix ¶
Matrix is everybody against everybody: row beat column this often.
The order of players is taken as given and used for both axes, so a caller that hands over the ranking gets a matrix in ranking order. Duplicate ids are dropped rather than producing two rows for one person.
Reading it: the cell in Anna's row and Bodo's column is Anna's record against Bodo. Bodo's row against Anna's column is the mirror image, which is redundant on purpose — somebody looking up "how do I stand against her" should find it on their own line, not have to transpose.
type Totals ¶
type Totals struct {
// Matches, Sets and Points count confirmed matches only.
Matches, Sets, Points int
// Deuce is how many sets went past the ordinary finish — both players on
// at least points_to_win minus one, so the set needed a two-point gap to
// end. It is the closest thing to "how evenly matched is this group"
// that a count can express, and it speaks to the starting-rating
// question in issue #17.
Deuce int
// LongestSet is the highest combined score of any single set;
// LongestSetHome and LongestSetAway state it the way it was played. All
// three are zero before the first confirmed match.
LongestSet int
LongestSetHome int
LongestSetAway int
// Whitewashes are matches won without dropping a set. A count, and the
// counterpart to Deuce: one says how close it gets, the other how
// one-sided.
//
// Matches played over a single set are left out, and that is the whole
// point of the number. There, winning without dropping a set is what
// winning *is*: every single-set win would be a whitewash, and a count
// that says "41 of 50" because 40 of them were one-setters describes the
// mode the office plays in rather than how one-sided its matches are.
Whitewashes int
}
Totals is what the office has played, as plain counts.