Modify display of 'n' in HUD for large numbers
When sample size grows to larger than 1000, use "X.Yk" notation to show the approximate value.
This commit is contained in:
parent
b996a884de
commit
94ab5849fa
|
@ -245,8 +245,20 @@ def saw_f(stat_dict, player):
|
|||
def n(stat_dict, player):
|
||||
""" Number of hands played."""
|
||||
try:
|
||||
# If sample is large enough, use X.Yk notation instead
|
||||
_n = stat_dict[player]['n']
|
||||
fmt = '%d' % _n
|
||||
if _n >= 1000:
|
||||
k = _n / 1000
|
||||
c = _n % 1000
|
||||
_c = float(c) / 100.0
|
||||
d = int(round(_c))
|
||||
if d == 10:
|
||||
k += 1
|
||||
d = 0
|
||||
fmt = '%d.%dk' % (k, d)
|
||||
return (stat_dict[player]['n'],
|
||||
'%d' % (stat_dict[player]['n']),
|
||||
'%s' % fmt,
|
||||
'n=%d' % (stat_dict[player]['n']),
|
||||
'n=%d' % (stat_dict[player]['n']),
|
||||
'(%d)' % (stat_dict[player]['n']),
|
||||
|
|
Loading…
Reference in New Issue
Block a user