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