Guest User

Untitled

a guest
Apr 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import sys
  2. import itertools
  3.  
  4. ROWS = '12345678'
  5. COLS = 'ABCDEFGH'
  6.  
  7. def get_moves_gadget():
  8. return '\n'.join(['get_moves <{},{}>'.format(square[0], square[1]) for square in itertools.product(ROWS, COLS)])
  9.  
  10. def main(argv):
  11. if len(argv) != 2:
  12. print('USAGE: python {} test.in'.format(argv[0]))
  13. return -1
  14.  
  15. with open(argv[1], 'r') as f:
  16. commands = f.read().strip().split('\n')
  17. padded_commands = ''.join([command + '\n' + get_moves_gadget() + '\n' for command in commands])
  18.  
  19. with open(argv[1] + '.padded', 'w') as f:
  20. f.write(padded_commands)
  21.  
  22. if __name__ == '__main__':
  23. sys.exit(main(sys.argv))
Add Comment
Please, Sign In to add comment