|
VoltMod
C++23 framework for CS2 server plugins
|
A score that loses half its weight every half-life - the building block for evidence that should fade with age rather than expire on a window edge. More...
#include <DecayingScore.hpp>
Public Member Functions | |
| DecayingScore ()=default | |
| DecayingScore (double halfLifeSec) | |
| void | SetHalfLife (double halfLifeSec) |
| double | HalfLife () const |
| double | Add (double now, double weight=1.0) |
| double | Value (double now) const |
| void | Clear () |
A score that loses half its weight every half-life - the building block for evidence that should fade with age rather than expire on a window edge.
Holds one value and one timestamp, so it costs the same whether it saw one event or a thousand. Time is caller-supplied (seconds, any monotonic origin) so the class stays clock-free and testable; pass the same time source to every call.
A half-life of 0 or less never decays, which is how a score latches.
Definition at line 18 of file DecayingScore.hpp.
|
default |
|
inlineexplicit |
Definition at line 22 of file DecayingScore.hpp.
Ages the score to now, adds weight, and returns the result.
Definition at line 29 of file DecayingScore.hpp.
References VoltMod::ReadFile(), and Value().
|
inline |
Definition at line 48 of file DecayingScore.hpp.
|
inline |
Definition at line 26 of file DecayingScore.hpp.
Takes effect from the next Value; weight already accrued is not re-aged.
Definition at line 25 of file DecayingScore.hpp.
References VoltMod::ReadFile().
The score at now, leaving the stored value and stamp alone.
Definition at line 37 of file DecayingScore.hpp.
References VoltMod::ReadFile().
Referenced by Add().