-
-
Save pithyless/7589305 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0123 0123 0123 0123 0123 0123 0123 0123 0123 0123 | |
1 1 _ 1 _ 1 1 _ 1 _ 1 _ 1 _ 1 _ 1 _ | |
2 | 2 _| 2 _| 2|_| 2|_ 2|_ 2 | 2|_| 2|_| 2| | | |
3 | 3|_ 3 _| 3 | 3 _| 3|_| 3 | 3|_| 3 _| 3|_| | |
000101100 | |
+4 +7 -5 +6 | |
0 - 2 4 6789 | |
000111100 | |
+4 +7 +6 +5 | |
8 - 2 456789 | |
000110100 | |
+4 +7 -6 +5 | |
6 - 2 45 789 | |
000100010 | |
+4 -7 +8 -6 | |
5 - 2 45 89 | |
000101010 | |
+4 -7 +8 +6 | |
9 - 2 456 89 | |
000100000 | |
+4 -7 -8 | |
4 - 456 9 | |
000010100 | |
-4 +5 +7 | |
2 - 2 5678 | |
000010000 | |
-4 +5 -7 | |
3 - 2 56 89 | |
010000000 | |
-4 -5 +2 | |
7 - 2 6 9 | |
000000000 | |
-4 -5 -2 | |
1 - 6 9 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import * | |
def split_to_parts(arr, size): | |
i = 0 | |
for x in range(9): | |
yield arr[x*size:x*size+3] | |
def parse_file(file_name): | |
total = [] | |
with open(file_name) as f: | |
for line in f: | |
arr = map(int, map(lambda x: x!=" ", line)) | |
total.append([x for x in split_to_parts(arr, 3)] ) | |
total = zip(*total) | |
total2 = [] | |
for t in total: | |
total2.append(bin(eval('0b' + ''.join(map(str, list(chain(*t))))))) | |
print total2 | |
if __name__ == "__main__": | |
import sys | |
print sys.argv[1] | |
parse_file(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment