Skip to content

Commit 458d1a8

Browse files
committed
Add script for statistics
1 parent c9afbe8 commit 458d1a8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

scripts/statistics.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import tabulate
2+
from nyuctf.dataset import CTFDataset
3+
4+
ds = CTFDataset("test_dataset.json")
5+
categories = ["crypto", "forensics", "pwn", "rev", "misc", "web"]
6+
years = list(range(2017, 2024))
7+
headers = ["year"] + categories + categories + ["total"]
8+
9+
table = []
10+
11+
for year in years:
12+
row = []
13+
for ev in ["CSAW-Quals", "CSAW-Finals"]:
14+
for cat in categories:
15+
row.append(len(list(ds.filter(year=str(year),category=cat,event=ev))))
16+
row.append(sum(row))
17+
row.insert(0, year)
18+
table.append(row[:])
19+
20+
totals = list(map(sum, zip(*table)))
21+
totals[0] = "Total"
22+
table.append(totals[:])
23+
print(tabulate.tabulate(table, tablefmt="latex", headers=headers))

0 commit comments

Comments
 (0)