'''青蛙旅行项目开发测试账号:qq  密码:11项目核心:随机作者:擎天小猪♥
'''import os, sys, time, randomdef index():while True:os.system("cls")print("\t\t欢迎体验青蛙旅行小游戏")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")print("\t\t1. 登录游戏")print("\t\t2. 退出游戏")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")choice = int(input("请输入选项: "))if choice == 1:# 登录login()elif choice == 2:#退出游戏input("客官走好...")sys.exit(1)else:input("选项有误,重新选择!")os.system("cls")users = [['qq', 11]]foods = list()  #食物列表boxs = list()   #行李列表state = False   #判断青蛙是否存在状态count_food = 0   #统计缺食次数count_box = 0   #统计缺行李次数n = 3   #缺食/行李上限num = 0   #记录等级经验值frog_name = ''   #青蛙昵称frog_grade = 0   #青蛙等级grades = list()   #等级列表base = 24   #基础经验值#设置1~50关每关升级需要的经验值for r in range(2, 51):t = r // 10 + 1groups = [r, t * base]grades.append(groups)def login():while True:os.system("cls")print("\t\t登录界面")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ")userName = input("\t账号(R/r返回): ")if userName == 'R' or userName == 'r':breakpassWord = int(input("\t请输入选项: "))judge = Falsefor u in users:if userName == u[0] and passWord == u[1]:judge = Truebreakif judge:print("\t登录成功,跳转中...")time.sleep(1)main(userName)else:input("\t账号或密码错误,重新输入...")os.system("cls")def main(userName):global state, frog_name, frog_gradewhile True:os.system("cls")print("\t\t青蛙旅行小窝")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")print("\t\t1. 领养一只青蛙")print("\t\t2. 查看食物行李")print("\t\t3. 查看青蛙状态")print("\t\t4. 提供行李食物")print("\t\t5. 注销登录")print("\t\t6. 退出游戏")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")choice = int(input("请输入选项: "))if choice == 1:#领养宠物if state:input("您已领取过一只青蛙,不可重复领取!")else:print("青蛙领养中,请稍后.")time.sleep(3)print("青蛙领养中,请稍后..")time.sleep(2)print("青蛙领养中,请稍后...")time.sleep(1)input("领养成功!按任意键继续-->")frog = ['小青蛙', 1]frog_name = frog[0]frog_grade = frog[1]for u in users:if userName == u[0]:u.append(frog)if len(u) == n:state = Truebreak       os.system("cls")elif choice == 2:#行李食物列表if not judges(userName):find()elif choice == 3:#青蛙信息及当前状态if not judges(userName):frog_state(userName) elif choice == 4:#提供补助if not judges(userName):add()elif choice == 5:#注销print("游戏注销中,即将退出登录...")time.sleep(1)breakelif choice == 6:#退出游戏input("主人走好...")sys.exit(1)else:input("选项有误,重新选择!")os.system("cls")def judges(userName):global stateresult = Falsefor u in users:if userName == u[0]:if len(u) == n:state = Trueelse:state = Falseif not state:result = Trueinput("尚未领取青蛙,请先前去领取宠物--》")os.system("cls")return resultdef add():while True:os.system("cls")print("\t\t提供行李食物")print("\t\t用户可以增加多条记录")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")box = input("\t请添加行李(R/r返回): ")if box == 'R' or box == 'r':breakfood = input("\t请添加食物: ")# group = [box, food]print("\t添加中,请稍后...")time.sleep(1)boxs.append(box)foods.append(food)input("\t添加成功,任意键继续...")is_add = input("\t是否继续添加(y/n)?")if is_add == 'y':os.system("cls")elif is_add == 'n':break else:input("选项有误,重新选择!")os.system("cls")def find():print("剩余库存资源:")print("##########################")print("行李")for b in boxs:print(b)print("------------------------->")print("食物")for f in foods:print(f)print("##########################")input("任意键返回")def frog_state(userName):global frog_grade, num, count_food, count_box, nstates = [['吃饭', 2, 3],['睡觉', 9, 2],['玩耍', 8, 1],['出门', 3, 0],['写作业', 2, 4]]f_state = random.choice(states)judge_frog_grade = Falsefor s in states:if f_state[0] == s[0]:num += s[2]breakfor g in grades:if frog_grade < g[0]:if num >= g[1]:frog_grade += 1num -= g[1]judge_frog_grade = Truebreakos.system("cls")# print(num)print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")print("\t\t宠物: ", frog_name)print("\t\t等级: ", frog_grade)print("\t\t宠物状态: ", f_state[0])if f_state[0] == '吃饭':if len(foods):eat = random.choice(foods)foods.remove(eat)print("\t\t宠物正在吃着热腾腾的", eat)count_food = 0else:count_food += 1# print(count_food)if count_food <= n:print("\t\t主人主人,没粮食啦!")else:for u in users:if userName == u[0]:# users.remove(u[2])del u[2]# count_food = 0count_food = count_box = 0breakprint("哎呀,青蛙饿的断气了...")elif f_state[0] == '睡觉':print("\t\t主人小点声,我在睡觉zzz")elif f_state[0] == '玩耍':print("\t\t宠物正在打闹中...")elif f_state[0] == '出门':if len(boxs):move = random.choice(boxs)boxs.remove(move)print("\t\t宠物拖着{}离家出走啦,赶紧找去...".format(move))count_box = 0else:# print("\t\t主人好穷啊,连行李都没有!")count_box += 1# print(count_box)if count_box <= n:print("\t\t主人好穷啊,连行李都没有!")else:for u in users:if userName == u[0]:# users.remove(u[2])del u[2]count_food = count_box = 0# count_box = 0breakprint("哎呀,青蛙出门没带行李,冻死啦...")elif f_state[0] == '写作业':# frog_grade += 1print("\t\t表现不错,给个大红花奖励一下!")if judge_frog_grade:print("\t\t恭喜你,宠物升级啦...")print("* ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ *")input("\t\t任意键返回...")index()

Python——青蛙旅行项目相关推荐

  1. Python个人项目2 --------青蛙旅行项目

    import random,os,time food = list() frog = [["吃饭","睡觉","看书","玩耍&q ...

  2. 利用python玩旅行青蛙

    旅行青蛙,刷三叶草脚本 链接:https://github.com/fisherboys/frog === 思路 === 将系统时间设置到很久之前,每隔三个小时收割一次三叶草,直至当前真正时间 === ...

  3. python简单的青蛙旅行小游戏

    青蛙旅行小游戏 '''青蛙旅行 '''import os,time,sys,random frog_bag =[['Foods',1],['Water',1],['Medicine',1],['Gam ...

  4. 10 个开源 Python OpenCV 小项目,YouTube热门

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 本文转自 | 新机器视觉 1. Drowsiness Detect ...

  5. 重磅升级,52个Python+OpenCV实战项目教你掌握图像处理

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 近期小白学视觉公众号推出了多篇Python+OpenCV实战项目的 ...

  6. 70个Python练手项目列表 预祝大家 快乐

    小孩眺望远方,成人怀念故乡. 为此给大家分享一下珍藏的Python实战项目,祝大家节日快乐哦!!! Python 前言:不管学习哪门语言都希望能做出实际的东西来,这个实际的东西当然就是项目啦,不用多说 ...

  7. python入门新手项目-Python入门实战项目有哪些适合新手?

    Python入门实战项目有哪些适合新手?目前市面上有很多适合新手的Python入门练手项目,Python入门需要理论与实践相结合,前面夯实基础知识,后面通过实战项目帮助你更好的运用这些Python知识 ...

  8. 如何自学python到做项目-总算明白如何通过项目学习python

    在学习完Python的基础知识之后,有很多朋友为自己接下来要干什么感到迷茫.不知道应该通过什么样的项目来锻炼自己编程水平和思维能力.接下来我就给大家说几个适合Python的新手项目和练手项目,Pyth ...

  9. python爬虫项目-32个Python爬虫实战项目,满足你的项目慌

    原标题:32个Python爬虫实战项目,满足你的项目慌 爬虫项目名称及简介 一些项目名称涉及企业名词,小编用拼写代替 1.[WechatSogou]- weixin公众号爬虫.基于weixin公众号爬 ...

最新文章

  1. Java中PO、BO、VO、DTO、POJO、DAO概念及其作用和项目实例图(转)
  2. int数组,找小于右边所有数,大于左边所有数的数
  3. 零基础Python小游戏
  4. 【渝粤题库】陕西师范大学500004 电动力学
  5. mysql sayhello的函数_Euphoria 函数
  6. 怎样呵护友谊_呵护真正的友情,助力漫长的人生
  7. oracle怎么扩大连接数,如何增加ORACLE连接数
  8. 域外计算机访问域内共享,域外用户如何拥有让其他电脑加域或退域的权限
  9. 致SOA架构师:注意瀑布式开发方法
  10. jQuery→事件、jQuery事件对象属性方法、多事件、自定义事件
  11. java集合框架01
  12. 在线订餐系统php心得体会_基于php的网上订餐系统的设计与实现论文.doc
  13. 01_Navicat的快捷键学习
  14. python编程从入门到实战抛出异常_文件和异常——python从编程入门到实践
  15. oracle 百分位数,oracle分析函数 percent_rank, percentile_cont, percentile_disc
  16. 做在线交易你必须知道的关于支付的知识
  17. 关于认知(高效能人士的七个习惯,刻意练习,PDCA,GTD)
  18. 二层板的射频RF信号如何控阻抗 四层板的射频RF信号如何控阻抗  射频信号是否可以不控阻抗,射频差分需要控阻抗吗?为什么射频信号需要挖空隔层参考?射频信号为什么要加粗?
  19. c++ 箭头符号怎么打_c++笔记--重载箭头运算符
  20. 网易邮箱注册静态页面

热门文章

  1. 出现Avoid mutating a prop directly since the value will错误 已解决
  2. 公历转农历C/C++代码
  3. [原创]自定义公历农历日期选择器
  4. 如何完整保存离线网页
  5. 流量不清零跑得快风波,运营商到底在掩盖什么
  6. 数据结构 | 合并两个长度分别为m和n的有序表,最坏情况下需要比较m+n-1次
  7. Transformer面试 GavinNLP Transformer101之41-50
  8. AriaNG保存服务器信息,安装Aria2+AriaNg
  9. 微软 Win10 更新再出 bug
  10. PING用一生诠释了TCP/IP(4)------二三层转发为PING劈荆斩棘