猫史档案馆


【Python作品分享】博饼【作品秀】

用户:AidiBoyAidiBoy查看:0 回复:0 评论:0 创建时间:2022-09-10T21:06:46


【作品展示】

center_image

 

【作品介绍】

123456

 

【作品源代码】

import random
# 设置变量:
a = 0
s1 = 0
s2 = 0
s3 = 0
s4 = 0
s5 = 0
s6 = 0
# 判断:
for i in range(6):
    a = random.randint(1, 6)
    if (a == 4):
        s4 = (s4 + 1)
    print(a, end = '')
    if (a == 2):
        s2 = (s2 + 1)
    if (a == 1):
        s1 = (s1 + 1)
    if (a == 3):
        s3 = (s3 + 1)
    if (a == 5):
        s5 = (s5 + 1)
    if (a == 6):
        s6 = (s6 + 1)
print(' ')
# 结果:
if (s4 == 4 and s1 == 2):
    print(('状元插金花!!!' + '\n'))
elif (s4 == 6):
    print(('六博红!' + '\n'))
elif (s4 >= 4):
    print(('状元4!' + '\n'))
elif (s6 == 6):
    print(('六博黑!' + '\n'))
elif (s1 == 5 or s2 == 5 or s3 == 5 or s5 == 5 or s6 == 5):
    print(('五子登科!' + '\n'))
elif (s1 == 4 or s2 == 4 or s3 == 4 or s5 == 4 or s6 == 4):
    print(('四进' + '\n'))
elif (s4 == 3):
    print(('三红' + '\n'))
elif (s4 == 2):
    print(('二举' + '\n'))
elif (s4 == 1):
    print(('一秀' + '\n'))
elif (s1 == s2 == s3 == s4 == s5 == s6 == 1):
    print(('对堂' + '\n'))
elif (s5 == 6):
    print('状元5')
elif (s3 == 6):
    print('状元3')
elif (s2 == 6):
    print('状元2')
elif (s1 == 6):
    print('状元1')
else:
    print(('很遗憾,再试一次' + '\n'))

    

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页