Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import itertools
- ROWS = '12345678'
- COLS = 'ABCDEFGH'
- def get_moves_gadget():
- return '\n'.join(['get_moves <{},{}>'.format(square[0], square[1]) for square in itertools.product(ROWS, COLS)])
- def main(argv):
- if len(argv) != 2:
- print('USAGE: python {} test.in'.format(argv[0]))
- return -1
- with open(argv[1], 'r') as f:
- commands = f.read().strip().split('\n')
- padded_commands = ''.join([command + '\n' + get_moves_gadget() + '\n' for command in commands])
- with open(argv[1] + '.padded', 'w') as f:
- f.write(padded_commands)
- if __name__ == '__main__':
- sys.exit(main(sys.argv))
Add Comment
Please, Sign In to add comment