Last active
August 29, 2015 13:57
-
-
Save wandernauta/9590491 to your computer and use it in GitHub Desktop.
drawmap.c
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
i=0;j=0;w=160;f=40;t;b;p;s;e;k;d=86400;q=599;char* m="M('+z EDz :!#\"!*!8S$[\"!$!#\"\")\"!3R)V$'!!()1M./!F)\"!!!!)'/GE5@\"\"!&%.3&,Y$D\"!!%$)5i\"\"\"F\"%&&6%!e'A#!#!!#&$5&!f&A'$*\"5&!c-#'3''8\"$!!#\"U'\"=5$'8#$$\"S(#=7!*5\"!\"#['!A@6#!^H=!#6bH;!!!\"6_!!I;<&!&\"!!$\"F\"!I8;&\"#\"$&#\"C#\"I7<%#!\"/\"BP5=$*,\"=#\"$!L4A%&\"\"G\"\"\"#M1@)*F\"%P/@,!N#!S(E;!@W'E=!!!<Y&D7!&!\"$7\\$D8!)$4_$C8!('&#&!!a&@9!&(%$&g$>9!$*#(%h\">:!!-\"(%&!b!$&5:!\"+\"(!!#$!!!c+5<-!'!'!#!e)5:.!(!&!\"\"e,:25!!!\"!\"\"h-;07#\"$h.9/:\"\"$!!#\"a17-;'!\"$!!\"$!X46,<\"%\"&$\\45,>#&!$$#!W45,C!!!'!\"!$!V26,H\"#!$!\"!\"!S17-#!A!!#\"!_07,\"#A&!\"`.7+#\"A*.!Q.7*$\">/^-9)$\"=0^*<)$!>1]*<(D1])>&E2\\)>&F&!)\\)@#G$%(\\'w%]'x#,\"P%z .\"P%z .!R$z -\"S$z b#z c#z d#z 3";main(){t=(time(0)%d*160)/d;printf("P2\n%d 62\n5\n",w);for(;i<q;i++){for(j=m[i]-' ';j>0;j--){p=k%w,s=(t-f),e=(t+f);printf("%c ", "1324"[b*2+((p>s&&p<e)||(p>s+w&&p<e+w)||(p>s-w&&p<e-w))]);k++;}b=!b;}} |
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
import sys | |
import itertools | |
limit = 90 | |
f = open(sys.argv[1]) | |
input = ''.join(f.readlines()[3:]) | |
filtered_input = list(filter(lambda x: x in ['0', '1'], list(input))) | |
grouped = itertools.groupby(filtered_input) | |
lengths = list([len(list(x[1])) for x in grouped]) | |
filtered_lengths = sum([([limit, 0, x-limit] if x > limit else [x]) for x in lengths], []) | |
output = ''.join([chr(ord(' ') + x) for x in filtered_lengths]) | |
sys.stdout.buffer.write(output.encode('unicode_escape')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment