glogglog

python challenge(8-14)

level8:

the un and pw startswith 'BZh', which is magic number of a bz2 file, so you use bz2 module:

bz2.decompress

http://www.pythonchallenge.com/pc/return/good.html


level9:

first and second is coordinations of pots.

use ImageDraw.polygon([first],fill=color)

I first tried gnu, then cow, at last bull

http://www.pythonchallenge.com/pc/return/bull.html


level10:

len(a[30]) = ?

a = [1, 11, 21, 1211, 111221, 

the next item is the description of previous item
11 is one 1
21 is two 1
1211 is one two, one one
111221 is one one, one two, two one

http://www.pythonchallenge.com/pc/return/5808.html

level11:

http://bg5hfc.spaces.live.com/blog/cns!E67CCF4FFB0BE86!1147.entry

I still have no idea how they get the way.

http://www.pythonchallenge.com/pc/return/evil.html


level12:

evil2.jpg-->evil2.gfx

dispatch this file to five file, you'll get the word by "file" them.

http://www.pythonchallenge.com/pc/return/disproportional.html


level13:

xml-rpc phonebook.php listMethods

555-ITALY

try -- 555-48259 55548259 ITALY italy

http://www.pythonchallenge.com/pc/return/italy.html


level14:

wire.png is a 10000*1 image, convert to 100*100?

consider

remember: 100*100 = (100+99+99+98) + (...

and title of this level "walk around"

source below:

import Image

def turn():
global fl,fi,f
fi=(fi+1)%4
f=fl[fi]

src = Image.open('wire.png')
des = Image.new('RGB', (100,100))

# direction functions
r = lambda (x,y):(x+1,y)
d = lambda (x,y):(x,y+1)
l = lambda (x,y):(x-1,y)
u = lambda (x,y):(x,y-1)

# direction functions list
fl = [r,d,l,u]

# current direction function index
fi = 0

# current direction function
f=r

# current postion
pos = (-1,0)

index = -1
for i in range(100):
index += 1
pos = f(pos)
des.putpixel(pos,src.getpixel((index,0)))


for i in range(99,0,-1):
for m in range(2):
turn()
for k in range(i):
index += 1
pos = f(pos)
des.putpixel(pos,src.getpixel((index,0)))

des.save('cat.png')

http://www.pythonchallenge.com/pc/return/cat.html

 

 

 




Blogs refer to this post:
yuaeuqnd:yuaeuqnd


sevenever@gmail.com
Copyright © 2008. All rights reserved.