“王者荣耀”之猜数字(简略版)
- “王者荣耀”之猜数字(简略版) 推荐度:
- 相关推荐
“王者荣耀”之猜数字(简略版)
程序理念
做着玩玩而已,娱乐一下,对于刚学python,刚跟世界问好的小伙伴们可以参考借鉴一下_
主程序
import random
import easygui as egeg.msgbox("欢迎来到王者农耀^-^")
msg = "发起进攻(1~10)"
title = "王者农耀"
guess = eg.integerbox(msg, title, lowerbound = 1, upperbound = 10)while True:if guess == secret:eg.msgbox("You're winner!")eg.msgbox("But,没有奖励.")breakelse:if guess > secret:eg.msgbox("敌方已使用闪现,继续追吧!")else:eg.msgbox("你以使用闪现,逃吧!")guess = eg.integerbox(msg, title, lowerbound=1, upperbound=10)eg.msgbox("游戏结束")
程序解释
首先导入模块
import random
import easygui as eg
然后创建窗口
eg.msgbox("欢迎来到王者农耀^-^")
msg = "发起进攻(1~10)"
title = "王者农耀"
guess = eg.integerbox(msg, title, lowerbound = 1, upperbound = 10)
Finaly, 做游戏主体,也就是无限循环部分,用If else 语句完成整个游戏功能。
while True:if guess == secret:eg.msgbox("You're winner!")eg.msgbox("But,没有奖励.")breakelse:if guess > secret:eg.msgbox("敌方已使用闪现,继续追吧!")else:eg.msgbox("你以使用闪现,逃吧!")guess = eg.integerbox(msg, title, lowerbound=1, upperbound=10)eg.msgbox("游戏结束")
This is my game,这就是我做的小游戏,恭候大家的指教。
最新文章
- 一欧拉函数(Euler‘s totient function)
- 请仔细品味
- “脱离应用开发者的数据库,不会成功”,黄东旭万字长文剖析数据库发展新趋势...
- VMware虚拟机使用Ubuntu全屏问题
- AndroidWidget——GridView 学习笔记
- Pytorch、TorchVision、Python、Jetpack版本匹配问题
- Revit 二次开发前景
- Azure App object和Service Principal
- 大数定律的形象理解
- 数字芯片设计流程
- mmap 详解
- 第五章
- win server服务器 关闭危险端口 135,137,138,139,445的方法
- 如何编写Python爬虫
- STM32F4
- jsp中文传值到java乱码
- CLAHE
- supersqli(SQL注入流程及常用SQL语句)
- cs,ds,ss,es?即cs,ds,ss,es的区别
- C语言简单实现通讯录