介绍
游戏介绍
平时自己学python,大家肯定很是无聊,推荐一个很早之前的网页版python闯关游戏——Python Challenge,虽然说这个网站很早了,但是很有意思,你会发现这些游戏一点也不简单,基本都需要通过编程来解决……
有意思的是,这是个解谜游戏,所以需要你细心去发现线索,破解谜底,并且考察的知识量也不是很小,很有意思。
游戏链接:http://www.pythonchallenge.com/
界面是这样的:
点击图中Click here to get challenged
开始挑战。
0-4关攻略
(0-4关攻略:点击这里直接查看)
写在前面
从第五关起,后面的关卡都是比较难的,但是我们是站在巨人的肩膀上的,我们可以参考前人智慧。
另外,其实每一关的网页标题都是有一定的提示作用的,注意查看。
关卡
第5关
提示pronounce it
,貌似没头绪,查看源代码:
<html>
<head>
<title>peak hell</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<center>
<img src="peakhell.jpg"/>
<br><font color="#c0c0ff">
pronounce it
<br>
<peakhell src="banner.p"/>
</body>
</html>
<!-- peak hell sounds familiar ? -->
可以看见注释<!-- peak hell sounds familiar ? -->
读起来熟悉吗??其实就是pickle
库,得到URL:http://www.pythonchallenge.com/pc/def/pickle.html
进去之后发现一句话yes! pickle!
,看来方向没错,但是没用。
网页标题是peak hell
,网页源代码也有个peakhell
标签,http://www.pythonchallenge.com/pc/def/banner.p
看看再说,像是这样,看不懂:
看来需要pickle
了,上代码:
import pickle
from urllib.request import urlretrieve
url = 'http://www.pythonchallenge.com/pc/def/banner.p'
urlretrieve(url, filename = 'five.pkl')
with open('five.pkl', 'rb') as f:
r = pickle.load(f)
结果是这样的
[(' ', 95)], [(' ', 14), ('#', 5), (' ', 70), ('#', 5), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 15), ('#', 4), (' ', 71), ('#', 4), (' ', 1)], [(' ', 6), ('#', 3), (' ', 6), ('#', 4), (' ', 3), ('#', 3), (' ', 9), ('#', 3), (' ', 7), ('#', 5), (' ', 3), ('#', 3), (' ', 4), ('#', 5), (' ', 3), ('#', 3), (' ', 10), ('#', 3), (' ', 7), ('#', 4), (' ', 1)], [(' ', 3), ('#', 3), (' ', 3), ('#', 2), (' ', 4), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 2), (' ', 2), ('#', 3), (' ', 6), ('#', 4), (' ', 1), ('#', 7), (' ', 3), ('#', 4), (' ', 1), ('#', 7), (' ', 5), ('#', 3), (' ', 2), ('#', 3), (' ', 5), ('#', 4), (' ', 1)], [(' ', 2), ('#', 3), (' ', 5), ('#', 3), (' ', 2), ('#', 5), (' ', 4), ('#', 4), (' ', 3), ('#', 3), (' ', 3), ('#', 4), (' ', 4), ('#', 5), (' ', 4), ('#', 4), (' ', 2), ('#', 5), (' ', 4), ('#', 4), (' ', 3), ('#', 3), (' ', 5), ('#', 3), (' ', 3), ('#', 4), (' ', 1<