First iteration of a working initcounters method
This commit is contained in:
@@ -17,6 +17,7 @@ class Minter():
|
||||
|
||||
oacounter: int = 0
|
||||
oatop: int = 0
|
||||
percounter: int = 0
|
||||
template: str = ""
|
||||
prefix: str = ""
|
||||
mask: str = ""
|
||||
@@ -97,11 +98,11 @@ class Minter():
|
||||
# 10. return the noid
|
||||
return ""
|
||||
|
||||
def initcounters() -> None:
|
||||
# 1. Initialize oacounter to 0
|
||||
# 2. Set up a maxcounters variable to 293
|
||||
# 3. Set up a percounter variable to int(total / maxcounters + 1)
|
||||
# 4. Divides $total into sub-counters of size $pctr, stores this
|
||||
def initcounters(self) -> None:
|
||||
# 1. [X] Initialize oacounter to 0
|
||||
# 2. [X] Set up a maxcounters variable to 293
|
||||
# 3. [X] Set up a percounter variable to int(total / maxcounters + 1)
|
||||
# 4. [X] Divides $total into sub-counters of size $pctr, stores this
|
||||
# distribution in $noid, and prepares the structure to generate
|
||||
# IDs in a balanced manner.
|
||||
# - copy the value of total to the variable t
|
||||
@@ -113,8 +114,14 @@ class Minter():
|
||||
# - set value of this counter to 0
|
||||
# - add the counter to saclist
|
||||
# - substract pctr from t
|
||||
pass
|
||||
|
||||
maxcounters = 293
|
||||
self.percounter = int(self.oatop / maxcounters + 1)
|
||||
t = self.oatop
|
||||
while t > 0:
|
||||
top = self.percounter if t >= self.percounter else t
|
||||
c = Counter(top=top, value=0)
|
||||
self.active_counters.append(c)
|
||||
t -= self.percounter
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
Reference in New Issue
Block a user