|
@@ -47,16 +47,18 @@ def step(start, finish):
|
|
assert start < midpoint and midpoint < finish
|
|
assert start < midpoint and midpoint < finish
|
|
return start, midpoint, finish
|
|
return start, midpoint, finish
|
|
|
|
|
|
-if __name__ == "__main__":
|
|
|
|
- from random import randint
|
|
|
|
|
|
+def show(steps):
|
|
|
|
+ print(" => ".join(str(s) for s in steps))
|
|
|
|
+
|
|
|
|
+def main():
|
|
|
|
+ from argparse import ArgumentParser
|
|
|
|
|
|
- for test in range(10000):
|
|
|
|
- i1 = Serial(randint(0, Serial.modulus - 1))
|
|
|
|
- i2 = Serial(randint(0, Serial.modulus - 1))
|
|
|
|
|
|
+ ap = ArgumentParser()
|
|
|
|
+ ap.add_argument("start", type = Serial)
|
|
|
|
+ ap.add_argument("finish", type = Serial)
|
|
|
|
+ args = ap.parse_args()
|
|
|
|
|
|
- assert i1 == i2 or \
|
|
|
|
- (i1 < i2 and not (i1 > i2)) or \
|
|
|
|
- (i1 > i2 and not (i1 < i2)) or \
|
|
|
|
- int(i1) & int(i2) == Serial.modulus >> 1
|
|
|
|
|
|
+ show(step(args.start, args.finish))
|
|
|
|
|
|
- print(f"{i1} => {i2}: {', '.join(str(s) for s in step(i1, i2))}")
|
|
|
|
|
|
+if __name__ == "__main__":
|
|
|
|
+ main()
|