diff 2.00/problem.py @ 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 5bbb68833868
line wrap: on
line diff
--- 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