File indexing completed on 2023-03-17 11:12:46
0001
0002
0003 from __future__ import print_function
0004 import sys
0005
0006 def main():
0007 if len(sys.argv) < 3:
0008 print("Usage: %s straightness layer_code" % sys.argv[0])
0009 return
0010
0011 straightness = int(sys.argv[1])
0012 layer_code = int(sys.argv[1])
0013
0014 if straightness > 7:
0015 raise Exception("straightness must be 0-7")
0016 if layer_code > 7:
0017 raise Exception("layer_code must be 0-7")
0018
0019 quality_code = 0
0020 quality_code = (
0021 (((straightness>>2) & 1) << 5) |
0022 (((straightness>>1) & 1) << 3) |
0023 (((straightness>>0) & 1) << 1) |
0024 (((layer_code>>2) & 1) << 4) |
0025 (((layer_code>>1) & 1) << 2) |
0026 (((layer_code>>0) & 1) << 0)
0027 )
0028
0029 print("0b{0:b}".format(quality_code))
0030 return
0031
0032
0033
0034 if __name__ == '__main__':
0035
0036 main()