<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Bookmarks by Yiqin Wang</title>
      <link>https://padlet.com/wangyq0902/Bookmarks</link>
      <description>Made with swagger</description>
      <language>en-us</language>
      <pubDate>2022-06-15 08:04:23 UTC</pubDate>
      <lastBuildDate>2022-06-15 08:29:25 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>Halo</title>
         <author></author>
         <link>https://padlet.com/wangyq0902/Bookmarks/wish/2221736031</link>
         <description><![CDATA[<div>我是林教授，以下是我的代码<br>import turtle</div><div><br><br></div><div># -----------------------------------------------------------------</div><div># 功能模块区，主要放置函数</div><div>def draw(p,img,x,y):</div><div>&nbsp; &nbsp; #绘制图像</div><div>&nbsp; &nbsp; global origin_x,origin_y,size</div><div>&nbsp; &nbsp; p.shape(img)</div><div>&nbsp; &nbsp; p.goto(origin_x+x*size,origin_y-y*size)</div><div>&nbsp; &nbsp; p.stamp()</div><div><br></div><div>def move_up():</div><div>&nbsp; &nbsp; global grid_y,grid_x,grid,result</div><div>&nbsp; &nbsp; if result !=2:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; grid_y -= 1</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x]==1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_y += 1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; elif grid_y &lt; 0:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_y +=1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; update()</div><div>&nbsp; &nbsp;&nbsp;</div><div>def move_down():</div><div>&nbsp; &nbsp; global grid_y,grid_x,grid,height,result</div><div>&nbsp; &nbsp; if result !=2:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; grid_y += 1</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x]==1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_y -= 1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; elif grid_y &gt; height-1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_y -=1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; update()</div><div><br></div><div>def move_left():</div><div>&nbsp; &nbsp; global grid_y,grid_x,grid,width,result</div><div>&nbsp; &nbsp; if result !=2:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; grid_x -= 1</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x]==1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_x += 1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return&nbsp;</div><div>&nbsp; &nbsp; elif grid_x &gt; width-1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_x +=1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; update()</div><div><br><br></div><div>def move_right():</div><div>&nbsp; &nbsp; global grid_y,grid_x,grid,width,result</div><div>&nbsp; &nbsp; if result !=2:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; grid_x += 1</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x]==1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_x -= 1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; elif grid_x &lt;0:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid_x -=1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return</div><div>&nbsp; &nbsp; update()</div><div><br></div><div>def update():</div><div>&nbsp; &nbsp; '''</div><div>&nbsp; &nbsp; 更新地图信息</div><div>&nbsp; &nbsp; '''</div><div>&nbsp; &nbsp; global grid,grid_x,grid_y</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x] == 2:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid[grid_y][grid_x] = 3</div><div>&nbsp; &nbsp; elif grid[grid_y][grid_x] == 3:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; grid[grid_y][grid_x]= 4</div><div>&nbsp; &nbsp; update_result()</div><div><br></div><div>def update_result():</div><div>&nbsp; &nbsp; '''</div><div>&nbsp; &nbsp; 更新游戏状态</div><div>&nbsp; &nbsp; '''&nbsp; &nbsp;</div><div>&nbsp; &nbsp; global grid,grid_x,grid_y,result</div><div>&nbsp; &nbsp; if grid[grid_y][grid_x] == 4:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; result = 0</div><div>&nbsp; &nbsp; else:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; result = 1</div><div>&nbsp; &nbsp; &nbsp; &nbsp; for i in grid:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if 2 in i:&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = 2</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break&nbsp; &nbsp;&nbsp;</div><div><br></div><div>def next_level():</div><div>&nbsp; &nbsp; global result,level_num,grid_x,grid_y,width,height,origin_x,origin_y,size</div><div>&nbsp; &nbsp; if result ==1:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; level_num +=1</div><div>&nbsp; &nbsp; result=2</div><div>&nbsp; &nbsp; grid = copy.deepcopy(level_store[level_num-1])</div><div>&nbsp; &nbsp; grid_x = position_store[level_num-1][0] &nbsp;</div><div>&nbsp; &nbsp; grid_y = position_store[level_num-1][1]</div><div>&nbsp; &nbsp; width = len(grid[0]) &nbsp;</div><div>&nbsp; &nbsp; height = len(grid) &nbsp;</div><div>&nbsp; &nbsp; origin_x = 0 - size * (width - 1) / 2 &nbsp;</div><div>&nbsp; &nbsp; origin_y = 0 + size * (height - 1) / 2 &nbsp;</div><div>&nbsp; &nbsp;&nbsp;</div><div># ------------------------------------------------------------</div><div># 基本信息区，放置游戏相关的一些信息</div><div>''' 地图二维列表信息&nbsp; 0: 空&nbsp; 1：墙壁&nbsp; 2：通道&nbsp; 3：目标&nbsp; 4：窟窿&nbsp; ''' &nbsp;</div><div>level_store =[[[1, 1, 1, 1, 1, 1],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1, 2, 2, 2, 2, 1],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1, 2, 1, 2, 2, 1],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1, 3, 1, 2, 2, 1],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1, 3, 2, 2, 2, 1],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[0, 1, 1, 1, 1, 1]],</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [[2, 2, 2, 2, 2, 2],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[2, 2, 2, 2, 2, 2],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[2, 1, 1, 2, 2, 2],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[2, 3, 2, 2, 3, 2],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[2, 2, 2, 2, 2, 2],&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[2, 2, 2, 2, 2, 2]]] &nbsp;</div><div>position_store = [[1,3], [4,1]]&nbsp; &nbsp;</div><div>level_num = 1</div><div>grid = copy.deepcopy(level_store[level_num-1])</div><div>size = 70 &nbsp;</div><div>width = len(grid[0]) &nbsp;</div><div>height= len(grid)&nbsp; &nbsp;</div><div>origin_x = 0 - size * (width - 1) / 2 &nbsp;</div><div>origin_y = 0 + size * (height - 1) / 2 &nbsp;</div><div># 角色初始位置 &nbsp;</div><div>grid_x = position_store[level_num-1][0] &nbsp;</div><div>grid_y = position_store[level_num-1][1]&nbsp; &nbsp;</div><div># 游戏状态 &nbsp;</div><div>'''&nbsp; result&nbsp; &nbsp;&nbsp;</div><div>0: 游戏结束&nbsp; &nbsp; 1：过关&nbsp; &nbsp; 2：游戏进行中''' &nbsp;</div><div>result = 2&nbsp; &nbsp;&nbsp;</div><div># ------------------------------------------------------------</div><div># 操作事件区，放置键鼠操作相关的内容</div><div>turtle.onkey(move_up,'Up')</div><div>turtle.onkey(move_down,'Down')</div><div>turtle.onkey(move_left,'Left')</div><div>turtle.onkey(move_right,'Right')</div><div>turtle.onkey(next_level,'Return')</div><div>turtle.listen()</div><div><br></div><div># ------------------------------------------------------------</div><div># 场景素材区，添加游戏画面相关的素材</div><div># 添加素材</div><div>tile_shapes = ['空.gif', '墙壁.gif', '通道.gif', '目标.gif','窟窿.gif']</div><div>for i in tile_shapes:</div><div>&nbsp; &nbsp; turtle.addshape(i)</div><div>turtle.addshape('编程猫.gif')</div><div>turtle.addshape('遮罩.gif')&nbsp; &nbsp;&nbsp;</div><div>result_shapes = ['失败.gif', '成功.gif', '空.gif']&nbsp; &nbsp;&nbsp;</div><div>for i in result_shapes:&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; turtle.addshape(i)&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp;&nbsp;</div><div><br></div><div># ------------------------------------------------------------</div><div># 画面绘制区，绘制场景用的画笔，绘制场景的代码</div><div>p = turtle.Pen()</div><div>p.penup()</div><div>turtle.tracer(False)</div><div>p.hideturtle()</div><div>p.goto(origin_x, origin_y)</div><div>while True:</div><div>&nbsp; &nbsp; p.clear()</div><div>&nbsp; &nbsp; for i in range(len(grid)):</div><div>&nbsp; &nbsp; &nbsp; &nbsp; for j in range(len(grid[i])):</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; draw(p,tile_shapes[grid[i][j]],j,i)</div><div><br></div><div>#绘制编程猫</div><div>&nbsp; &nbsp; draw(p,'编程猫.gif',grid_x,grid_y)</div><div>&nbsp; &nbsp; draw(p,'遮罩.gif',grid_x,grid_y)</div><div>&nbsp; &nbsp; draw(p, result_shapes[result], (width-1)/2, (height-1)/2)&nbsp; &nbsp;</div><div>&nbsp; &nbsp; turtle.update()</div><div><br></div><div>turtle.done()</div><div><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-06-15 08:28:41 UTC</pubDate>
         <guid>https://padlet.com/wangyq0902/Bookmarks/wish/2221736031</guid>
      </item>
      <item>
         <title>我也是林教授</title>
         <author></author>
         <link>https://padlet.com/wangyq0902/Bookmarks/wish/2221736738</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/1732524639/14a3ef476322e56ca02a4dd336633f23/image.png" />
         <pubDate>2022-06-15 08:29:25 UTC</pubDate>
         <guid>https://padlet.com/wangyq0902/Bookmarks/wish/2221736738</guid>
      </item>
   </channel>
</rss>
