In the thymic cortex, each developing T cell (thymocyte) randomly rearranges its T-cell receptor (TCR) genes, giving every cell a different, fixed binding affinity a (0–1) for the self-peptide-MHC complexes displayed by cortical and medullary stromal cells. As a cell drifts down through the cortex it is "tested" once against this self-antigen.
Fate(a):
if a < θ_pos → death by neglect (TCR can't engage self-MHC at all)
elif a > θ_neg → negative selection (dangerously self-reactive → apoptosis)
else (θ_pos ≤ a ≤ θ_neg) → positive selection (functional & self-tolerant → survives)
Only thymocytes whose affinity falls in the narrow window between the two thresholds survive: strong enough to recognise self-MHC (so the cell can ever respond to any peptide presented on it), weak enough not to attack the body's own tissues. This affinity-window model is the physical basis of central tolerance.
- θpos slider — raises/lowers the minimum affinity needed to survive death by neglect.
- θneg slider — raises/lowers the affinity ceiling above which self-reactive cells are deleted.
- Production rate slider — how many new thymocytes enter the cortex per second.
- Pause / Reset — freeze the simulation or restart the cohort and all counters.
In real biology, mutations narrowing this window (e.g. defective AIRE-driven self-antigen display in the medulla) let self-reactive T cells escape negative selection, contributing to autoimmune disease; a window that is too narrow instead starves the periphery of a useful T-cell repertoire.