CTFd icon indicating copy to clipboard operation
CTFd copied to clipboard

Incorrect fucntion name `logarithmic` in score decay algorithm

Open RocketMaDev opened this issue 4 months ago • 1 comments

The function logarithmic does the following calculations to get a new score, however, though it's named logarithmic, the actual algorithm is not. It's actually parabola.

The code is currently at https://github.com/CTFd/CTFd/blob/master/CTFd/plugins/dynamic_challenges/decay.py#L43

value = (
        ((challenge.minimum - challenge.initial) / (challenge.decay ** 2))
        * (solve_count ** 2)
    ) + challenge.initial

To illustrate that, here is a graph, drawing a typical PARABOLA in red, and a LOGARITHMIC CURVE in blue.

Image

I checked the document and it says:

CTFd uses a parabolic function instead of a linear, exponential, or logarithmic decay function...

I would like to know should the function name be renamed? It's a bit cheating...

RocketMaDev avatar Sep 16 '25 07:09 RocketMaDev

It will be tough to rename it now but it could possibly be done for the integration between dynamic+standard challenges. I think parabolic is probably the more correct term but I will need to investigate.

ColdHeat avatar Sep 16 '25 17:09 ColdHeat