Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add printing of scores per test #210

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/sinol_make/commands/run/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ def colorize_status(status):
return util.error(status)


def colorize_points(points, min_points, max_points):
if points == max_points:
return util.color_green(str(points))
elif points == min_points:
return util.color_red(str(points))
else:
return util.color_yellow(str(points))


def update_group_status(group_status, new_status):
order = [Status.CE, Status.TL, Status.ML, Status.RE, Status.WA, Status.OK, Status.PENDING]
if order.index(new_status) < order.index(group_status):
Expand Down Expand Up @@ -234,8 +243,13 @@ def print_group_seperator():
for program in program_group:
lang = package_util.get_file_lang(program)
result = all_results[program][package_util.get_group(test, task_id)][test]
print(("%23s" % color_memory(result.Memory, package_util.get_memory_limit(test, config, lang, task_id, args)))
if result.Memory is not None else 13*" ", end=" | ")
if result.Points:
print(colorize_points(result.Points, contest.min_score_per_test(),
contest.max_score_per_test()).ljust(13), end="")
else:
print(3*" ", end="")
print(("%20s" % color_memory(result.Memory, package_util.get_memory_limit(test, config, lang, task_id, args)))
if result.Memory is not None else 10*" ", end=" | ")
print()

print_table_end()
Expand Down
14 changes: 13 additions & 1 deletion src/sinol_make/contest_types/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_global_score(self, groups_scores: Dict[int, Dict], global_max_score) ->
:return: Global score
"""
return sum(group["points"] for group in groups_scores.values())

def verify_config(self):
"""
Used for verifing contest specific config.yml settings
Expand All @@ -114,3 +114,15 @@ def additional_export_job(self):
:return: If not None, returned value will be used as name of the archive
"""
return None

def min_score_per_test(self):
"""
Returns minimum score for single test
"""
return 0

def max_score_per_test(self):
"""
Returns maximum score for single test
"""
return 100
6 changes: 6 additions & 0 deletions src/sinol_make/contest_types/icpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ def get_group_score(self, test_scores, group_max_score):

def get_global_score(self, groups_scores: Dict[int, Dict], global_max_score):
return min(group["points"] for group in groups_scores.values())

def min_score_per_test(self):
return 0

def max_score_per_test(self):
return 1
Loading