用户:
用户名称7个字查看:2 回复:3 评论:2 创建时间:2020-09-07T22:01:46
【作品展示】

【作品介绍】
新人编写的喵,不喜勿喷。以后学到的知识更多,一定会完善。
【作品源代码】
import turtle
import time
import random
life = 1
planet_sum = 1000
health = 100
there_body_year = 1
t = turtle.Pen()
turtle.bgcolor("black")
t.pencolor("red")
t.pensize(5)
t.penup()
t.goto(-50,-50)
t.pendown()
for i in range(3):
t.forward(100)
t.left(120)
t.penup()
t.goto(-50,0)
t.pendown()
for i in range(3):
t.forward(100)
t.right(120)
t.penup()
t.goto(-35,-130)
t.pendown()
t.write("E T O 荣誉出品")
turtle.done()
print("欢迎来到三体,这里有各种各样的事件。胜利条件为行星数据达到100。0以下则会失败。总之就听天由命吧!")
while True:
time.sleep(5)
if health > 0 and planet_sum < 100 and planet_sum > -1:
print("现在是第{}号文明的第{}年。行星数据值为{},健康值为{}。开始下一回合。".format(life,there_body_year,planet_sum,health))
time.sleep(5)
jy = random.randint(1,2)
if jy == 1:
print("现在是恒纪元。万物被一个太阳照耀,生机勃勃。(健康值+1,行星数值+2)")
health = health + 1
planet_sum = planet_sum + 2
if jy == 2:
print("现在是乱纪元。天空中乱七八糟。(健康值-1)")
health = health - 1
time.sleep(5)
rq = random.randint(0,20)
if rq == 1:
print("行星被外星文明入侵。(健康值-50,行星数值-50)")
health = health - 50
planet_sum = planet_sum - 50
if rq != 1:
print("一切正常。第",life,"号文明没有被被任何外星文明发现。(行星数值+1)")
planet_sum = planet_sum + 1
time.sleep(5)
bf = random.randint(0,25)
if bf != 1 and bf != 2:
print("一切正常,第",life,"号文明在在本年中没有遭到任何大规模科技起飞和大规模喵。(行星分数+1)")
planet_sum = planet_sum + 1
if bf == 1:
print("第",life,"号文明经历了科技大爆炸。(行星数据+10)")
planet_sum = planet_sum + 10
if bf == 2:
print("第", life, "号文明经历了内战和大规模喵,但科技也在战争下飞速提升。(行星数据+5,健康值-5)")
planet_sum = planet_sum + 5
health = health - 5
喵 = random.randint(1,5)
if 喵 == 1:
yon = int(input("第", life, "号文明发现了弱小得多的文明,对其入侵就选1,不则选2"))
if yon == 1:
att = random.randint(1,10)
if att == 1:
print("恭喜你,第", life, "号文明的坐标被广播了。招来了黑森打击。(行星数据-80,健康值-80)")
planet_sum = planet_sum - 80
health = health - 80
else:
print("一切都很顺利,第", life, "号文明找到了自己想要的东西。(行星数据+40,健康值+10)")
planet_sum = planet_sum + 40
health = health + 10
else:
print("有些民间团体认为第", life, "号文明错过了获取物资的大好机会,因此部分地区有些喵。(行星数据-1)")
planet_sum = planet_sum - 1
else:
print("这一年很平常,没有任何观测站方面的消息。")
time.sleep(5)
print("第", life, "号文明的第",there_body_year,"年已过去。进入下一回合")
there_body_year = there_body_year + 1
if health < 0:
print("侦测到第",life,"号文明在第",there_body_year,"三体年中健康值过低,文明已经毁灭。重启中......")
life = life + 1
health = 100
planet_sum = 0
there_body_year = 1
if planet_sum < 0:
print("侦测到第", life, "号文明在第",there_body_year,"三体年因数值过低爆发内战,文明已经毁灭。重启中......")
planet_sum = 0
health = 100
life = life + 1
there_body_year = 1
if planet_sum > 100:
print("三体第一二舰队已出发。它们将载着三体文明的希望寻找适合生存的家园!!!")
print("(侦测到该文明已胜利,游戏结束。感谢您对《三体》以及ETO的支持)")
break
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn