Skip to content

Commit 9b82b9f

Browse files
authored
Add printing of scores per test (#210)
1 parent ea6ec39 commit 9b82b9f

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

src/sinol_make/commands/run/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ def colorize_status(status):
5252
return util.error(status)
5353

5454

55+
def colorize_points(points, min_points, max_points):
56+
if points == max_points:
57+
return util.color_green(str(points))
58+
elif points == min_points:
59+
return util.color_red(str(points))
60+
else:
61+
return util.color_yellow(str(points))
62+
63+
5564
def update_group_status(group_status, new_status):
5665
order = [Status.CE, Status.TL, Status.ML, Status.RE, Status.WA, Status.OK, Status.PENDING]
5766
if order.index(new_status) < order.index(group_status):
@@ -234,8 +243,13 @@ def print_group_seperator():
234243
for program in program_group:
235244
lang = package_util.get_file_lang(program)
236245
result = all_results[program][package_util.get_group(test, task_id)][test]
237-
print(("%23s" % color_memory(result.Memory, package_util.get_memory_limit(test, config, lang, task_id, args)))
238-
if result.Memory is not None else 13*" ", end=" | ")
246+
if result.Points:
247+
print(colorize_points(result.Points, contest.min_score_per_test(),
248+
contest.max_score_per_test()).ljust(13), end="")
249+
else:
250+
print(3*" ", end="")
251+
print(("%20s" % color_memory(result.Memory, package_util.get_memory_limit(test, config, lang, task_id, args)))
252+
if result.Memory is not None else 10*" ", end=" | ")
239253
print()
240254

241255
print_table_end()

src/sinol_make/contest_types/default.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def get_global_score(self, groups_scores: Dict[int, Dict], global_max_score) ->
100100
:return: Global score
101101
"""
102102
return sum(group["points"] for group in groups_scores.values())
103-
103+
104104
def verify_config(self):
105105
"""
106106
Used for verifing contest specific config.yml settings
@@ -114,3 +114,15 @@ def additional_export_job(self):
114114
:return: If not None, returned value will be used as name of the archive
115115
"""
116116
return None
117+
118+
def min_score_per_test(self):
119+
"""
120+
Returns minimum score for single test
121+
"""
122+
return 0
123+
124+
def max_score_per_test(self):
125+
"""
126+
Returns maximum score for single test
127+
"""
128+
return 100

src/sinol_make/contest_types/icpc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ def get_group_score(self, test_scores, group_max_score):
2929

3030
def get_global_score(self, groups_scores: Dict[int, Dict], global_max_score):
3131
return min(group["points"] for group in groups_scores.values())
32+
33+
def min_score_per_test(self):
34+
return 0
35+
36+
def max_score_per_test(self):
37+
return 1

0 commit comments

Comments
 (0)