笨方法学python 41:来自 Percal 25 号行星的哥顿人 (Gothons)

这篇博客介绍了通过代码模拟一个互动冒险游戏,玩家在'central_corridor'中遭遇来自Percal 25号行星的哥顿人。程序流程包括传入ROOMS字典和起点'central_corridor',执行函数,根据用户输入决定行动,最终可能导向死亡场景。玩家尝试躲避攻击时,系统随机选择一条死亡消息回应。
摘要由CSDN通过智能技术生成

代码:

#coding:utf-8
from sys import exit  # 通过from...import...导入sys模块,将exit直接导入程序
from random import randint # 通过from...random导入random模块,将randint直接导入程序

def death():   # 定义death函数
    quips = ["You died, You kinda suck at this.""Nice job, you died ...jackass.""Such a luser.""I have a small puppy that's better this."]

    print quips[randint(0, len(quips)-1)]  # random.randint(a,b)用于生成一个指定范围内的整数
    exit(1)  # 有错误退出


def central_corridor():  # 定义central_corridor函数
    print "The Gothos of Planet Percal #25 have invaded your ship and destroyed"
    print "your entire crew. You are the last surviving member and your last"
    print "mission is to get the neutrondesttttruct bomb from the Weapons Armory,"
    print "put it in the bridge, and blow the ship up after getting into an"
    print "escape pod."
    print "\n"
    print "You're running down the central corridor to the Weapons Armory when"
    print "a Gothon jumps out, red scaly skin, dark grimy teeth, and evil clown costume"
    print "flowing around his hate filled body. He's blocking the door to the"
    print "Armory and about to pull a weapon to blast you."

    action = raw_input("> ")


    if action == "shoot!":
        print "Quick on the draw you yank out your blater and fire it at the Gothon."
        print "His clown costume is flowing and moving around his bod, which throws"
        print "off your aim. Your laser hits his costume but misses him entirely. This"
        print 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值