Adding the pseudocode of the _n2xdig method
This commit is contained in:
@@ -97,6 +97,28 @@ class Minter():
|
|||||||
self.active_counters.append(c)
|
self.active_counters.append(c)
|
||||||
t -= self.percounter
|
t -= self.percounter
|
||||||
|
|
||||||
|
def _n2xdig(self, num) -> str:
|
||||||
|
# 1. Initialize s to ''
|
||||||
|
# 2. Déclare div, remainder and c
|
||||||
|
# 3. Confirm well-formedness of mask
|
||||||
|
# 4. Initialize varwidth to 0, the fixed width part of the mask
|
||||||
|
# 5. Initialize rmask (reverse mask)
|
||||||
|
# 6. While n != 0 OR not varwidth
|
||||||
|
# - if not varwidth
|
||||||
|
# - take a character from the rmask
|
||||||
|
# - if c is not defined or c is r or s
|
||||||
|
# - end the loop
|
||||||
|
# - if c is equal to e then div is equal to alphacount
|
||||||
|
# - if c is equal to d then div is equal to digitcount
|
||||||
|
# - if c is equal to z then varwidth become 1 and we keep the same div value
|
||||||
|
# - if c is equal to k then we keep the same div value
|
||||||
|
# - remainder <- num %div
|
||||||
|
# - num <- int(num / div)
|
||||||
|
# - s = self.legalstring[remainder] + s
|
||||||
|
# 7. if mask contains a 'k' then add a '+' at the end of s
|
||||||
|
# 8. return s
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user