/
8.py
66 lines (50 loc) · 2.11 KB
/
8.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
"""
http://www.w3schools.com/tags/att_area_coords.asp
x1,y1,x2,y2,..,xn,yn - Specifies the coordinates of the edges of the polygon.
If the first and last coordinate pairs are not the same, the browser will add
the last coordinate pair to close the polygon (for shape="poly")
un: 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw: 'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
http://matplotlib.org/devdocs/examples/shapes_and_collections/artist_reference.html
"""
import bz2
coords_string = (
"179,284,214,311,255,320,281,226,319,224,363,309,339,222,371,225,411,229,"
"404,242,415,252,428,233,428,214,394,207,383,205,390,195,423,192,439,193,"
"442,209,440,215,450,221,457,226,469,202,475,187,494,188,494,169,498,147,"
"491,121,477,136,481,96,471,94,458,98,444,91,420,87,405,92,391,88,376,82,"
"350,79,330,82,314,85,305,90,299,96,290,103,276,110,262,114,225,123,212,"
"125,185,133,138,144,118,160,97,168,87,176,110,180,145,176,153,176,150,"
"182,137,190,126,194,121,198,126,203,151,205,160,195,168,217,169,234,170,"
"260,174,282"
)
def get_coordinates():
print coords_string
print '-' * 80
flat = coords_string.split(',')
flat_length = len(flat)
print "length of numbers:", flat_length
print "even?", (flat_length % 2) == 0
print '-' * 80
coords = []
for i in range(0, flat_length, 2):
x = i
y = i + 1
coord = (flat[x], flat[y])
print coord
coords.append(coord)
print '-' * 80
return coords
def main():
"""
Turns out the riddle has nothing to do with the polygonal shape of the
area. It only has to do with the bzip2 compression library. Just read a
hint in the forum.
"""
un = 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'
pw = 'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08'
print bz2.decompress(un)
print bz2.decompress(pw)
if __name__ == '__main__':
main()