Created
December 1, 2018 10:45
-
-
Save potetisensei/a17d9eadb7c320f3f868b60f73cf0c02 to your computer and use it in GitHub Desktop.
Script for create scoring functions in CODE BLUE CTF 2018 Finals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import floor | |
# For JNI, Fliqpy, EasyExample | |
#base = 50 | |
#div = [3, 6, 6, 6, 10, 15, 15, 15, 15, 9] | |
# For CTC, OSS, Account | |
base = 0 | |
div = [2.5, 5, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 2.5] | |
assert(sum(div) == 100) | |
n = len(div) | |
result = 'if succeeded == 0 then 0 elsif ' | |
cur = 0 | |
score = base | |
for k in div[:-1]: | |
cur += k | |
score += ((100-base)/n) | |
result += 'succeeded <= ((succeeded+failed) * {} / 100) then {} elsif '.format(cur, floor(score)) | |
score += ((100-base)/n) | |
assert (int(score) == 100) | |
result += 'succeeded < (succeeded+failed) then 99 else 100 end' | |
print(result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment