一个很简易的明日方舟抽卡模拟器~
本帖最后由 丫丫有C 于 2020-1-18 20:02 编辑做了一个明日方舟手游的抽卡模拟器~
不过只能测试你获得了几星干员..
代码很少,但是学到现在能动手制作一点东西很开心o (>▽<) o
源代码如下:
import random as r
import easygui as g
def ck():
title1 = 'Yy有希酱'
msg1 = '请输入一次性抽卡数量(不要输入字符咩~)'
numf = g.enterbox(msg1,title1)
num = int(numf)
x3 = 0 #这里设定各星级干员的初始数量
x4 = 0
x5 = 0
x6 = 0
for i in range(num):
a = r.randint(1,100) #利用随机数在区间的位置判定干员星级
if 1 <= a <= 50:
x3 += 1
if 51 <= a <= 90:
x4 += 1
if 91 <= a <= 98:
x5 += 1
if 99 <= a <= 100:
x6 += 1
msg2_1 = '总共抽卡%s次!\n小伙汁,你获得了%s个三星干员\n%s个四星干员\n%s个五星干员\n' % (num,x3,x4,x5)
msg2_2 = '可喜可贺!宁获得了%s个六星干员!' % x6
msg2 = msg2_1 + msg2_2
g.msgbox(msg2,title1,image = 'yc02.gif')
title2 = 'Yy有希酱'
msg3 = ' 小伙汁~欢迎来到丫丫的明日方舟抽卡带模拟器~'
g.buttonbox(msg3,title2,['Let\'s Go!'],image = 'yc02.gif')
ck()
while 1:
choice = g.ccbox('是否继续?',choices = ['是','否']) #判定是否继续玩耍
if choice:
ck()
else:
break
页:
[1]