Adding a rank attribute to the Counter class and update initialization of our counters

This commit is contained in:
2026-07-15 21:06:11 +02:00
parent 832cf45441
commit 10f0555011
+4 -1
View File
@@ -7,6 +7,7 @@ from typing import ClassVar
@dataclass @dataclass
class Counter(): class Counter():
rank: int
top: int top: int
value: int value: int
@@ -92,11 +93,13 @@ class Minter(Persistent):
maxcounters = 293 maxcounters = 293
self.percounter = int(self.oatop / maxcounters + 1) self.percounter = int(self.oatop / maxcounters + 1)
t = self.oatop t = self.oatop
n = 0
while t > 0: while t > 0:
top = self.percounter if t >= self.percounter else t top = self.percounter if t >= self.percounter else t
c = Counter(top=top, value=0) c = Counter(top=top, value=0, rank=n)
self.active_counters.append(c) self.active_counters.append(c)
t -= self.percounter t -= self.percounter
n += 1
def _n2xdig(self, num) -> str: def _n2xdig(self, num) -> str:
# 1. Initialize s to '' # 1. Initialize s to ''