青蛙旅行小游戏

'''青蛙旅行
'''import os,time,sys,random
frog_bag =[['Foods',1],['Water',1],['Medicine',1],['Games',1]]
frog_refrigerator = [['Foods',1],['Water',1],['Medicine',1],['Games',1]]
player_bag = [10, [['Foods',2],['Water',2],['Medicine',2],['Games',2]]]
clove_count = 0
frog_life = 3
frog_name = []
#进入游戏while True:os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog trip!")print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")while 1:#判断是否注册if  not frog_name:print("Please give your little frog a name!")frog_name1=input("Plseas:")print("Your frog's name is:",frog_name1)print("Agree or not?")frog_name_choice = input("Please(Y/N):")#确认昵称if frog_name_choice == 'Y':print("Registered successfully!")frog_name.append(frog_name1)print("Your frog's name is:",frog_name[0])input("About to return to the superior menu...")os.system('cls')breakelse:print("Please input again!")continueelse:breakbreak#游戏选择功能界面
while True:os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog trip!")print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("           HOME PAGE")print("     1.Open the bag ")print("     2.Open the refrigerator")print("     3.Collect the clove  ")print("     4.Open the shop ")print("     5.Enter the cabin ")print("     6.Log out  ")print("  ")print("Please select ")player_choice = input("Please:")#功能选择#打开背包if player_choice == '1':while 1:os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog's bag!")print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print("Stock:",frog_bag)print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("     1.Increase the items  ")print("     2.Return to previous menu")print("")print("Please select ")player_choice = input("Please:")#添加物品if player_choice == '1':while 1:os.system('cls')#青蛙背包print("")print("                Frog_bag")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(frog_bag)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")#玩家背包print("                Player_bag")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(player_bag)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")#展示食物选择print("  List of optional items")print("     1.Foods ")print("     2.Tirsty")print("     3.Medicine ")print("     4.Games")print("     5.Return to previous menu")print("")player_choice = input("Please enter the items to be added:")#选择添加的食物if player_choice == '1':if player_bag[1][int(player_choice)-1][1] <= 0:input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_bag[int(player_choice)-1][1] +=1elif player_choice == '2':if player_bag[1][int(player_choice)-1][1] <= 0:input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_bag[int(player_choice)-1][1] +=1elif player_choice == '3':if player_bag[1][int(player_choice)-1][1] <= 0:input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_bag[int(player_choice)-1][1] +=1elif player_choice == '4':if player_bag[1][int(player_choice)-1][1] <= 0:input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_bag[int(player_choice)-1][1] +=1elif player_choice == '5':input("About to return to the superior menu...")breakelse:print("Please enter the correct number!")time.sleep(2)continuerequest = input("Whether to add or not(Y/N):")if request == 'Y':continueelse:print("N")#添加完成,展示青蛙背包input("Add completed, press any key to continue...")os.system('cls')print("")print("                Frog_bag")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(frog_bag)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")input("Press any key to continue...")break#返回上级菜单elif player_choice == '2':input("About to return to the superior menu...")break#输入错误else:print("Please enter the correct number!")time.sleep(2)continue#打开冰箱elif player_choice == '2':while 1:os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog's refrigerator!")print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print("Stock:",frog_refrigerator)print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("     1.Increase the items ")print("     2.Return to previous menu")print("")print("Please select ")player_choice = input("Please:")#添加物品if player_choice == '1':while 1:os.system('cls')#青蛙冰箱print("")print("                Frog_refrigerator")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(frog_refrigerator)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")#玩家背包print("                Player_bag")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(player_bag)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")#展示食物选择print("List of optional items")print("     1.Foods ")print("     2.Water")print("     3.Medicine ")print("     4.Games")print("     5.Return to previous menu")print("")player_choice = input("Please enter the food to be added:")#选择添加的食物if player_choice == '1':if player_bag[1][int(player_choice)-1][1] <=0 :input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_refrigerator[int(player_choice)-1][1] +=1elif player_choice == '2':if player_bag[1][int(player_choice)-1][1] <=0 :input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_refrigerator[int(player_choice)-1][1] +=1elif player_choice == '3':if player_bag[1][int(player_choice)-1][1] <=0 :input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_refrigerator[int(player_choice)-1][1] +=1elif player_choice == '4':if player_bag[1][int(player_choice)-1][1] <=0 :input("Not enough stock...")else:player_bag[1][int(player_choice)-1][1] -=1frog_refrigerator[int(player_choice)-1][1] +=1elif player_choice == '5':input("About to return to the superior menu...")breakelse:print("Please enter the correct number!")time.sleep(2)continuerequest = input("Whether to add or not(Y/N)")if request == 'Y':continueelse:print("N")#添加完成,展示青蛙冰箱input("Add completed, press any key to continue...")os.system('cls')print("")print("                Frog_refrigerator")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print(frog_refrigerator)print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")input("Press any key to continue...")break#返回上级菜单elif player_choice == '2':input("About to return to the superior menu...")break#输入错误else:print("Please enter the correct number!")time.sleep(2)continue#随机获取三叶草elif player_choice == '3':while 1:if clove_count <= 0:print("Run out of!")print("Please come back later")input("Press any key to continue...")breakelse:os.system('cls')print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog's pond!")print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")input("Press any key to start collecting clove...")clove_count -= 1print("Residue degree",clove_count)clove_num = random.randint(1,30)player_bag[0] += clove_numprint("Collecting clove:",clove_num)print("ALL clove:",player_bag[0])request = input("Whether to add or not(Y/N):")if request == 'Y':continueelse:print("N")breakcontinue break#打开商店 elif player_choice == '4':while 1:os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog's shop!")print("")print("~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*")print("")print("     1.Foods(2clove) ")print("     2.Water(1clove)")print("     3.Medicine(5clove) ")print("     4.Games(3clove)")print("     5.Return to previous menu")print("")print("     Your's clove:",player_bag[0])print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("Please select ")player_choice = input("Please:")#买1号食物if player_choice == '1':if player_bag[0] < 2:input("Sorry, your credit is running low")continueelse:print("Use 2clove for 1APPLE")player_bag[0] -=2player_bag[1][int(player_choice)-1][1] +=1print("player_bag:",player_bag)input("Press any key to continue...")#买2号食物elif player_choice == '2':if player_bag[0] < 1:input("Sorry, your credit is running low")continueelse:print("Use 1clove for 1APPLE")player_bag[0] -= 1player_bag[1][int(player_choice)-1][1] +=1print("player_bag:",player_bag)input("Press any key to continue...")#买3号食物elif player_choice == '3':if player_bag[0] < 5:input("Sorry, your credit is running low")continueelse:print("Use 5clove for 1APPLE")player_bag[0] -= 5player_bag[1][int(player_choice)-1][1] +=1print("player_bag:",player_bag)input("Press any key to continue...")#买4号食物elif player_choice == '4':if player_bag[0] < 3:input("Sorry, your credit is running low")continueelse:print("Use 3clove for 1APPLE")player_bag[0] -= 3player_bag[1][int(player_choice)-1][1] +=1print("player_bag:",player_bag)input("Press any key to continue...")#返回上一级 elif player_choice == '5':input("About to return to the superior menu...")break#错误输入else:print("Please enter the correct number!")input("Press any key to continue...")continuerequest = input("Whether to Continue Purchasing(Y/N):")if request == 'Y':continueelse:print("N")break#进入小屋elif player_choice == '5':while True:frog_play = random.randint(1,10)os.system('cls')print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")print("       Welcome to the frog's the cabin!")print("")print("☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★")print("")if frog_life <= 0:os.system('cls')print("Unfortunately, your little frog died...")print("   ")print("The game will quit after 3S....")time.sleep(1)print("The game will quit after 2S....")time.sleep(1)print("The game will quit after 1S....")time.sleep(1)os.system('cls')print("THANKS!")sys.exit(1)breakelse:#出门玩耍if 1<= frog_play <5:while 1: #随机选的食物frog_xiaofei = random.choice(frog_bag)#随机选的食物的数量frog_food_num = frog_bag[frog_bag.index(frog_xiaofei)][1]if frog_food_num <= 0:frog_life -=1continueelse:frog_bag[frog_bag.index(frog_xiaofei)][1] -=1print("Going out to play...")print("Ate:",frog_xiaofei)input("Add completed, press any key to continue...")break#发呆elif 5<= frog_play <7:while 1:#随机选的食物frog_xiaofei = random.choice(frog_refrigerator)#随机选的食物的数量frog_food_num = frog_refrigerator[frog_refrigerator.index(frog_xiaofei)][1]if frog_food_num <= 0:frog_life -=1continueelse:frog_refrigerator[frog_refrigerator.index(frog_xiaofei)][1] -=1print("In a daze...")print("Ate:",frog_xiaofei)input("Add completed, press any key to continue...")break#学习elif 7<= frog_play <9:while 1:#随机选的食物frog_xiaofei = random.choice(frog_refrigerator)#随机选的食物的数量frog_food_num = frog_refrigerator[frog_refrigerator.index(frog_xiaofei)][1]if frog_food_num <= 0:frog_life -=1continueelse:frog_refrigerator[frog_refrigerator.index(frog_xiaofei)][1] -=1player_bag[0] += 5print("Learning...")print("Ate:",frog_xiaofei)input("Add completed, press any key to continue...")break#睡觉else:clove_count +=1print("Be sleeping ...")print("A day has passed...")input("Add completed, press any key to continue...")break#退出系统elif player_choice == '6':os.system('cls')print("The game will quit after 3S....")time.sleep(1)print("The game will quit after 2S....")time.sleep(1)print("The game will quit after 1S....")time.sleep(1)sys.exit(1)  #输入选项错误else:print("Please enter the correct number!")time.sleep(2)continue

python简单的青蛙旅行小游戏相关推荐

  1. Python 简单实现贪吃蛇小游戏

    文章目录 1. pygame库的简介2. pygame库的安装3. python代码实现贪吃蛇小游戏4. pyinstaller打包成exe 很多人学习python,不知道从何学起. 很多人学习pyt ...

  2. Python简单实现microbit传球小游戏

    项目描述: 程序开始时,一个小球( led 小灯)从屏幕上方移动到屏幕中间当按钮 A 按下时,小球向右移动,碰到屏幕边缘停止当按钮 B 按下时,小球向左移动,碰到屏幕边缘停止如果小球已经处于屏幕最右边 ...

  3. Py之tkinter:python最简单的猜字小游戏带你进入python的GUI世界

    Py之tkinter:python最简单的猜字小游戏带你进入python的GUI世界 目录 输出结果 设计思路 输出结果 设计思路 from tkinter import * import tkint ...

  4. Python制作简单的终端交互小游戏

    Python制作简单的终端交互小游戏 因为最近的集训课程中,老师让我们把python,java,nodejs都需要掌握,本人最常使用的是java,python许久没有用过,就想写一段逻辑来帮助自己复习 ...

  5. 用python做C语言的猜数字游戏,[Python3 练习] 007 简单的猜数字小游戏

    题目:简单的猜数字小游戏 (1) 描述 程序随机生成一个数字,玩家用键盘输入所猜数字,在规定次数内猜对为胜. (2) 要求 程序随机生成一个 1 到 100 的自然数 有 7 次机会去猜 机会用尽之前 ...

  6. python编写一个简单的猜数字小游戏

    该脚本包含了python基础的部分内容,python初学者既可以学习借鉴,也可以向朋友去装13. 本次编写的内容需要导入一个第三方模块random,可获得规定范围的随机数. 首先打开pycharm中下 ...

  7. 学生学python编程---实现贪吃蛇小游戏+源码

    学生学python编程---实现贪吃蛇小游戏+源码 前言 主要设计 1.蛇的表示 2.蛇怎么移动? 3.玩家控制小蛇移动功能的实现 4.如何判定游戏结束? 应用知识点 1.python知识点 1.1 ...

  8. c++代码小游戏_用Python编写一个打乒乓球小游戏

    Python功能十分强大,从科学计算到人工智 能,当然Python还可以编写游戏代码喔,虽然不是主流,但是是否应该了解一下呢?茶余饭后,编写一个很有趣的小游戏,编程半小时,能玩一整天,不断的调整游戏参 ...

  9. 编程猜单词游戏python_Python实现简单的猜单词小游戏

    本文实例为大家分享了Python实现猜单词小游戏的具体代码,供大家参考,具体内容如下 思路 1.一个words列表里存放若干的单词,例如:["extends", "pri ...

最新文章

  1. 【No.1_sizeof与strlen】
  2. 太强了!这款轻量级的数据库中间件完美解决了SpringBoot中分库分表问题
  3. php遍历数组的四种方法,PHP遍历数组的常见几种方法
  4. php redis 删除key 通配符,php中redis批量删除key的方法是什么
  5. php报错致命错误203,Centos7 下安装PHP7 phpredis扩展报错解决办法 致命错误:ext/standard/php_smart_str.h...
  6. 隐藏文件真实下载地址(支持超大文件)源码
  7. golang基础语法
  8. 一个好的销售团队需具备的4个特点
  9. django-celery beat报错 error pid
  10. PyTorch自定义CUDA算子教程与运行时间分析
  11. 委托和事件的一些理解笔记
  12. poj 2833 The Average(堆)
  13. 生物信息学中的机器学习:使用K-Means和PCA进行基因组序列分析 COVID-19接下来如何突变?
  14. 测试linux内核工具,多种测试linux内核的方法
  15. python下的xml创建以及追加信息,删除信息方法
  16. 对 input 千位分割
  17. JS中的事件委托 / 代理详解
  18. win7计算机高级设置在哪,windows7投屏设置在哪里
  19. android 面试题(三)
  20. 网上银行在计算机应用中,基于软件工程和J2EE的网上银行系统实现计算机应用技术专业论文.docx...

热门文章

  1. vue电商实战-黑马-01
  2. coc机器人苹果_警察机器人绳索英雄
  3. LightDM详细介绍
  4. 机器学习-02 基于sklearn 广义线性模型-普通最小二乘法
  5. Talib中文文档(二):Momentum Indicators 动量指标
  6. 第七篇 indicators(4)自建指标
  7. 云计算工程师必备技能图谱
  8. 当 update 修改数据与原数据相同时会被更新吗?
  9. bat 脚本的常用特殊符号
  10. linux在线文档库