python怎样实现简单飞行棋

  介绍

这篇文章主要介绍python怎样实现简单飞行棋,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

chess_main。py

import  chess_tools      #,输入玩家信息   chess_tools.input_player ()      while  chess_tools.end_flag:   for 才能;player  chess_tools.player_list:拷贝   ,,,chess_tools.ironman(球员)   ,,,输入(球员(“name") +“,请按enter掷骰子“)   ,,,chess_tools.throw(球员)   ,,,if  chess_tools.judge(球员),==,1:   ,,,,,休息   ,,,chess_tools.hit(球员)   ,,,chess_tools.speedup(球员)   ,,,印刷(“;”)

chess_tools。py

得到random  import  randint         时间=player_list  []   end_flag =1         def  input_player ():   num =,才能输入(“数据玩家数量:“)   小姐:才能=0   while 才能小姐:& lt;, int (num):   ,,,player_name =,输入(“输入第“,+,str(小姐:+,- 1),+,“位玩家名字:“)   ,,,play_info =, {“name": player_name,   ,,,,,,,,,,“score":, 0}   ,,,player_list.append (play_info)   ,,,小姐:=,小姐:+ 1         def 把(球员):   “才能”;“   玩才能家扔骰子,随机1 - 6点   :才能param 球员:,当前玩家   ,,:返回:   “才能”;“   时间=points 才能;randint (1,6)      #才能,首先判定是否起飞   if 才能的球员(“score"),==, 0,以及points ==, 6:   ,,,的球员(“score"),=, 1   ,,,print (“% d 点,恭喜起飞!当前在第% d格“,%,(点,球员(“score")))      elif 才能的球员(“score"),==, 0,以及points  & lt;, 6:   ,,,print (“% d 点,起飞失败!“,%,点)   ,才能返回   #,才能分数大于100,要后退,多几分退几步   elif 才能的球员(“score"), +, points 祝辞,100:   ,,,的球员(“score"),=,球员(“score"),安康;(球员(“score") +,点),%,100 +,1   ,,,print (“% d 点,飞过头了!回到% d格“,%,(点,球员(“score")))   其他的才能:   ,,,的球员(“score"), +=,点   ,,,print (“% d 点!当前在第% d格“,%,(点,球员(“score")))         def 法官(球员):   global  end_flag才能   if 才能的球员(“score"),==, 100:   ,,,end_flag =0   ,,,print(球员(“name") +“赢了”)   ,,,return  1         def 打击(球员):   “才能”;“   判才能断当前玩家是否会将领先的玩家撞回起飞位置   :才能param 球员:,当前玩家名字   “才能”;“   for 才能;other_player  player_list:拷贝   ,,,if 球员(“score"),==, other_player [“score"], \   ,,,,,,,以及other_player [“name"], !=,球员(“name"):   ,,,,,other_player [“score"],=0         def 加速(球员):   if 才能的球员(“score"),==, 15,趁机\   ,,,,,的球员(“score"),==, 35,趁机\   ,,,,,的球员(“score"),==, 85:   ,,,的球员(“score"), +=5   ,,,print(“加速5格,当前在% d格“,%,球员[“score"])         def 铁人(球员):   “才能”;“   主才能角光环,名字中含有指定字符的人可以获得50分加成   :才能param 球员:当前玩家的名字   “才能”;“   master 才能=,球员(“name") .count (“t")   if 才能;master 祝辞,0,以及球员(“score"),==, 0:   ,,,的球员(“score"),=, 50   ,,,print(“安康小姐:am  Iron 男人!贾维斯,先给我加50分!”)   ,,,print(“女人好的,% s 。当前已走到第50格!”,%,球员[“name"])   ,,,印刷(“;”)

python怎样实现简单飞行棋