Skip to content

Commit 48a6674

Browse files
committed
removed unused notes.md; calculatePoints.py refactoring to Python 3
1 parent fbc8ba9 commit 48a6674

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

calculatePoints.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22
# @author bl4de https://github.com/bl4de | https://ctftime.org/team/12769
33
#
44
# CTF event points -> CTFtime.org ranking points calculator
@@ -7,6 +7,7 @@
77
#
88
# Calculates team's points from CTF for CTFtime.org overall ranking
99
#
10+
from math import floor
1011

1112

1213
def calculate():
@@ -16,17 +17,22 @@ def calculate():
1617
place_coef = float(1) / team_place
1718

1819
if points_coef > 0:
19-
rating = ((points_coef + place_coef) * weight) / (1/(1+(team_place/total_teams)))
20+
rating = ((points_coef + place_coef) * weight) / \
21+
(1/(1+(team_place/total_teams)))
2022

2123
return rating
2224

25+
2326
if __name__ == '__main__':
2427

25-
team_place = int(raw_input("your team place in CTF: "))
26-
team_points = int(raw_input("earned CTF points: "))
27-
total_teams = int(raw_input("teams with any points (more than 0) in CTF: "))
28-
best_points = int(raw_input("winner team points: "))
29-
weight = int(raw_input("CTF event rating weight (by CTFtime.org): "))
28+
team_place = int(input("your team place in CTF: "))
29+
team_points = int(input("earned CTF points: "))
30+
total_teams = int(
31+
input("teams with any points (more than 0) in CTF: "))
32+
best_points = int(input("winner team points: "))
33+
weight = float(input("CTF event rating weight (by CTFtime.org): "))
34+
35+
weight = floor(weight)
3036

31-
print "\n### Your team earned {0:.3f} points in this CTF, congrats! ###"\
32-
.format(calculate())
37+
print("\nYour team earned {0:.3f} points in this CTF, congrats!".format(
38+
calculate()))

notes.md

-1
This file was deleted.

0 commit comments

Comments
 (0)