refactor(api): rename Agent to Competitor and .player field to .rating

Competitor holds dynamic per-history state (message, last_time) for
someone competing; its configuration lives in a Rating.

AgentStore renamed to CompetitorStore to match. The internal
`clean()` free function's parameter name changed from `agents` to
`competitors` for consistency.

Local variable names (agent_idx, this_agent) inside history.rs are
left unchanged — they represent abstract identifiers, not Competitor
instances.

Part of T2 of docs/superpowers/specs/2026-04-23-trueskill-engine-redesign-design.md.
This commit is contained in:
2026-04-24 10:48:50 +02:00
parent 88d54cb9f4
commit decbd895a3
9 changed files with 219 additions and 212 deletions

View File

@@ -1,7 +1,7 @@
use criterion::{Criterion, criterion_group, criterion_main};
use trueskill_tt::{
BETA, GAMMA, KeyTable, MU, P_DRAW, Rating, SIGMA, agent::Agent, batch::Batch,
drift::ConstantDrift, gaussian::Gaussian, storage::AgentStore,
BETA, Competitor, GAMMA, KeyTable, MU, P_DRAW, Rating, SIGMA, batch::Batch,
drift::ConstantDrift, gaussian::Gaussian, storage::CompetitorStore,
};
fn criterion_benchmark(criterion: &mut Criterion) {
@@ -11,13 +11,13 @@ fn criterion_benchmark(criterion: &mut Criterion) {
let b = index_map.get_or_create("b");
let c = index_map.get_or_create("c");
let mut agents: AgentStore<ConstantDrift> = AgentStore::new();
let mut agents: CompetitorStore<ConstantDrift> = CompetitorStore::new();
for agent in [a, b, c] {
agents.insert(
agent,
Agent {
player: Rating::new(Gaussian::from_ms(MU, SIGMA), BETA, ConstantDrift(GAMMA)),
Competitor {
rating: Rating::new(Gaussian::from_ms(MU, SIGMA), BETA, ConstantDrift(GAMMA)),
..Default::default()
},
);