Mercurial > ~astiob > upreckon > hgweb
changeset 24:c23d81f4a1a3
Score returned by TestCase.__call__() is now normalized to 0..1
TestCase.__call__() now returns the fraction (a number from 0 to 1) of case.points that is to be awarded.
Bug fix: %-patterns in configuration variables common to all problems are now substituted.
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Thu, 23 Sep 2010 00:11:24 +0000 |
parents | c1f52b5d80d6 |
children | b500e117080e |
files | 2.00/config.py 2.00/problem.py 2.00/testcases.py |
diffstat | 3 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/2.00/config.py Wed Sep 22 23:34:51 2010 +0000 +++ b/2.00/config.py Thu Sep 23 00:11:24 2010 +0000 @@ -118,9 +118,6 @@ for name in defaults_problem: if not hasattr(globalconf, name): setattr(module, name, getattr(module, name, defaults_problem[name])) - for name in patterns: - if hasattr(module, name): - setattr(module, name, getattr(module, name).replace('%', problem_name)) if not hasattr(module, 'path'): if hasattr(module, 'name'): module.path = module.name @@ -131,7 +128,11 @@ if options.no_maxtime: module.maxtime = 0 sys.dont_write_bytecode = dwb - return Config(module, globalconf) + module = Config(module, globalconf) + for name in patterns: + if hasattr(module, name): + setattr(module, name, getattr(module, name).replace('%', problem_name)) + return module def load_global(): dwb = sys.dont_write_bytecode
--- a/2.00/problem.py Wed Sep 22 23:34:51 2010 +0000 +++ b/2.00/problem.py Thu Sep 23 00:11:24 2010 +0000 @@ -137,14 +137,15 @@ comment = ' (%s)' % comment else: comment = '' - if granted == case.points: + if granted >= 1: ncorrect += 1 - if granted: ncorrectvalued += 1 + if case.points: ncorrectvalued += 1 verdict = 'OK' + comment elif not granted: verdict = 'wrong answer' + comment else: verdict = 'partly correct' + comment + granted *= case.points say('%g/%g, %s' % (granted, case.points, verdict)) real += granted weighted = real * prob.config.taskweight / max if max else 0
--- a/2.00/testcases.py Wed Sep 22 23:34:51 2010 +0000 +++ b/2.00/testcases.py Thu Sep 23 00:11:24 2010 +0000 @@ -321,7 +321,7 @@ pass else: raise WrongAnswer - return case.points + return 1 elif callable(case.validator): return case.validator(output) else: @@ -340,9 +340,9 @@ if case.process.returncode: raise WrongAnswer(comment) else: - return case.points, comment + return 1, comment else: - return case.points * case.process.returncode / case.problem.config.maxexitcode, comment + return case.process.returncode / case.problem.config.maxexitcode, comment class BatchTestCase(ValidatedTestCase):