return self._try_solution(options.ABS_TOL / 10)
except (PoorScalingException, GameUnsolvableException):
- # Ok, that didn't work. Let's try it with the default
- # tolerance, and whatever happens, happens.
- return self._try_solution(options.ABS_TOL)
+ # Ok, that didn't work. Let's try it with the default tolerance..
+ try:
+ return self._try_solution(options.ABS_TOL / 10)
+ except (PoorScalingException, GameUnsolvableException) as error:
+ # Well, that didn't work either. Let's verbosify the matrix
+ # output format before we allow the exception to be raised.
+ printing.options['dformat'] = options.DEBUG_FLOAT_FORMAT
+ raise error
def condition(self):
philosophers.
"""
+DEBUG_FLOAT_FORMAT = '%.20f'
+"""
+The float output format to use when something goes wrong. If we need to
+produce a random test case, for example, then we need all of the digits
+of the things involved. If we try to recreate the problem using only,
+say, the first seven digits of each number, then the resulting game
+might not reproduce the failure.
+"""
FLOAT_FORMAT = '%.7f'
"""