猫史档案馆


【Python作品分享】很难养的电子宠物【作品秀】

用户:0x00000004F0x00000004F查看:0 回复:1 评论:0 创建时间:2022-06-30T21:05:25


【作品展示】

center_image

 

【作品介绍】

这条小金鱼很难养

 

【作品源代码】

import random


# 金鱼宝宝基本属性
print('小金鱼Bobo fish陪你玩耍!')
jwxspgs = 0
tl = 100
cls = 0
b = 20
sf = 0
fs = 0
xq=100
ssxs=0
bsd=100
wd=26
#游戏开始后
while True:
    #播报当前状态
    bsd-=(random.randint(10,15))
    wd=random.randint(-20,50)
    print("当前心情值:",xq)
    print("当前体力值:",tl)
    print("当前产卵数",cls)
    print("目前温度:",wd)
    print("当前肾上腺素储备:"+str(ssxs)+"支肾上腺素")
    print("当前饱食度:",bsd)
    print("当前有健胃消食片个数:",jwxspgs)
    #判断当前状态是否可以
    if bsd<=0:
        fs=input("小金鱼饿喵了,是否要用肾上腺素救活它?(y/n)")
        if fs=="y":
            print("小金鱼活了")
        else:
            print("小金鱼喵了,开席!")
            break
    if wd>=45:
        print("小金鱼热喵了")
        fs=input("是否开空调?(y/n)")
        if fs=="y":
            print("小金鱼缓过来了")
        elif fs=="n":
            print("小金鱼喵了,开席!")
            break
        else:
            print("小金鱼喵了,开席!")
            break
    elif wd<=-15:
        print("小金鱼冷喵了")
        fs=input("是否要开暖气?(y/n)")
        if fs == "y":
            print("小金鱼缓过来了")
        elif fs == "n":
            print("小金鱼喵了,开席!")
            break
        else:
            print("小金鱼喵了,开席!")
            break
    else:
        pass
    #询问用户
    a = input('要小金鱼Bobo fish为你做什么:')
    #判断用户输入的内容
    if (a == 'eat'):
        print('什么东西,真香')
        xq+=60
        bsd+=50
        tl+=50
        if (tl >= 500)or(bsd>=500):
            print('你的小金鱼撑喵了')
            sf = input((('你有' + str(jwxspgs)) + '颗健胃消食片,是否要使用?(y/n)'))
            if (sf == 'y' and jwxspgs > 0):
                print('你的小金鱼活了')
                jwxspgs -= 1
                tl -= 300
            else:
                print('你的小金鱼喵了,开席!')
                break
    elif (a == 'lay'):
        b = random.randint(1, 100)
        print('产了', b, '颗卵')
        tl -= 50
        xq-=40
        cls += b
        if (b <= 5):
            print('你的小金鱼因为产卵数太少,所以气喵了')
            fs = input('是否安抚(y/n)')
            if (fs == 'y'):
                print('你的小金鱼活了')
            else:
                print('你的小金鱼喵了,开席!')
                break
        if (tl <= 0):
            print('你的小金鱼累喵了')
            print('产卵:', cls, '颗卵')
            fs = input("你的小金鱼累喵了,你喵+str(ssxs)+"支肾上腺素,是否要用肾上腺素救活它?(y/n)")
            if fs == "y" and ssxs > 0:
                print("你的小金鱼活了")
                ssxs -= 1
            else:
                print("你的小金鱼喵了,开席!")
                break
        if (cls >= 30):
            jwxspgs += 1
            print('你的小金鱼产卵数很多,所以获得健胃消食片一片(健胃消食片用于小金鱼撑喵时复活)')
        else:
            pass
    elif a=="play":
        print("你和你的小金鱼玩了一会,小金鱼很开心")
        xq+=30
        if xq<0:
            fs = input("你的小金鱼伤心喵了你喵+str(ssxs)+"支肾上腺素,是否要用肾上腺素救活它?(y/n)")
            if fs == "y" and ssxs > 0:
                print("你的小金鱼活了")
                ssxs-=1
            else:
                print("你的小金鱼喵了,开席!")
                break
        elif xq>=1000:
            fs = input("你的小金鱼伤心喵了你喵+str(ssxs)+"支肾上腺素,是否要用肾上腺素救活它?(y/n)")
            if fs == "y" and ssxs > 0:
                print("你的小金鱼活了")
                ssxs -= 1
            else:
                print("你的小金鱼喵了,开席!")
                break
        if xq>=200:
            ssxs+=1
            xq-=50
            print("你获得了一个肾上腺素")
    else:
        print('小金鱼Bobo不知道你的意思')
        xq-=40

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
含蓄的雷电猴dkOl含蓄的雷电猴dkOl

请问您消耗了多少阳寿写出来的呢?

点赞0


评论