《python小游戏代码.pdf》由会员分享,可在线阅读,更多相关《python小游戏代码.pdf(3页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、from random import choicecava_numbers=range(0,20)cavas=for i in cava_numbers:cavas.append()unvisited_cavas=range(0,20)visited_cavas=0unvisited_cavas.remove(0)while unvisited_cavas!=:i=choice(visited_cavas)if len(cavasi)=3:continuenext_cava=choice(unvisited_cavas)cavasi.append(next_cava)cavasnext_cav
2、a.append(i)visited_cavas.append(next_cava)unvisited_cavas.remove(next_cava)for i in cava_numbers:while len(cavasi)if(not player_input.isdigit()orint(player_input)not in cavasplayer_location):print player_input,?print Thats not a direction that i can seeelse:player_location=int(player_input)if player_location=wumpus_location:print Aargh!You got esten by a Wumpus!break