deckar01 / CTFd

CTFs as you need them
https://ctfd.io
Apache License 2.0
1 stars 2 forks source link

Enhancement: Challenges with decaying points #4

Open ShyftXero opened 7 years ago

ShyftXero commented 7 years ago

It might be interesting to have challenges that lower in value for as teams solve them.

This would have the effect of having to store a store as opposed to calculate a score as is currently done in https://github.com/deckar01/CTFd/blob/master/CTFd/scoreboard.py.

This might break 3rd normal form, but hang in there...

In keeping with the theme of having new challenge types as plugins is wise.

A few additional db columns woud need to be created to support the new challenge type.

In order to display the current "worth" of the challenge. This is what you assign on a challenge_base_value * 1 - (challenge_decay_rate * number_of_solves)

You would have to calculate this at solve time calculated_value = challenge_base_value * 1 - (challenge_decay_rate * number_of_solves) ) if calculated_value < challenge_minimum_value: Teams.team[x].score += challenge_minimum_value else: Teams.team[x].score += calculated_value (I'm dumb and can't format thing correctly.)

It doesn't seem unreasonable to me for that score column to be located in the Teams table.

These are just a few ideas I had regarding the subject.

someone has done some work on this front already. https://github.com/CTFd/CTFd/issues/330#issuecomment-327621314

Thoughts or ideas?

deckar01 commented 7 years ago

I think this feature should go in the standard challenge. It should probably go in a custom challenge type that overrides the standard challenge type to avoid upstream conflicts.

The core would need to delegate the responsibility of calculating the score to the challenge class. That is already on my radar.

deckar01 commented 7 years ago

One thing to consider is what challenges would actually use this. I think it might create a frustrating experience to solve a hard challenge, then find out a bunch of teams solved it before you and it wasn't worth much anymore.

A more balanced way to reward teams that solve problems fast would be to decay constantly based on how long the contest has been running. Challenges could decay to a percentage of their original value by the end of the competition.

deckar01 commented 7 years ago

I implemented the special case of "first blood" so that the first team gets a bonus.

https://github.com/deckar01/FirstBloodChallenge

The problem with the challenge's points decaying is that there is no easy way to keep the scores of the teams who solved it early from dropping also. The DynamicValueChallenge decays challenge points with each solve, but it decays the points of existing solves.