java 刽子手图像代码,刽子手游戏代码

类刽子手():

definit(自身):

打印“欢迎来到‘刽子手’,你准备好死了吗?”

打印“(1)是的,因为我已经死了。\n(2)不,把我弄出去!”

用户选项1=原始输入(“->”)if user_choice_1 == '1':

print "Loading nooses, murderers, rapists, thiefs, lunatics..."

self.start_game()

elif user_choice_1 == '2':

print "Bye bye now..."

exit()

else:

print "I'm sorry, I'm hard of hearing, could you repeat that?"

self.__init__()

def start_game(self):

print "A crowd begins to gather, they can't wait to see some real"

print "justice. There's just one thing, you aren't a real criminal."

print "No, no. You're the wrong time, wrong place type. You may think"

print "you're dead, but it's not like that at all. Yes, yes. You've"

print "got a chance to live. All you've gotta do is guess the right"

print "words and you can live to see another day. But don't get so"

print "happy yet. If you make 6 wrong guess, YOU'RE TOAST! VAMANOS!"

self.core_game()

def core_game(self):

guesses = 0

letters_used = ""

the_word = "pizza"

progress = ["?", "?", "?", "?", "?"]

while guesses < 6:

guess = raw_input("Guess a letter ->")

if guess in the_word and not in letters_used:

print "As it turns out, your guess was RIGHT!"

letters_used += "," + guess

self.hangman_graphic(guesses)

print "Progress: " + self.progress_updater(guess, the_word, progress)

print "Letter used: " + letters_used

elif guess not in the_word and not(in letters_used):

guesses += 1

print "Things aren't looking so good, that guess was WRONG!"

print "Oh man, that crowd is getting happy, I thought you"

print "wanted to make them mad?"

letters_used += "," + guess

self.hangman_graphic(guesses)

print "Progress: " + "".join(progress)

print "Letter used: " + letters_used

else:

print "That's the wrong letter, you wanna be out here all day?"

print "Try again!"

def hangman_graphic(self, guesses):

if guesses == 0:

print "________ "

print "| | "

print "| "

print "| "

print "| "

print "| "

elif guesses == 1:

print "________ "

print "| | "

print "| 0 "

print "| "

print "| "

print "| "

elif guesses == 2:

print "________ "

print "| | "

print "| 0 "

print "| / "

print "| "

print "| "

elif guesses == 3:

print "________ "

print "| | "

print "| 0 "

print "| /| "

print "| "

print "| "

elif guesses == 4:

print "________ "

print "| | "

print "| 0 "

print "| /|\ "

print "| "

print "| "

elif guesses == 5:

print "________ "

print "| | "

print "| 0 "

print "| /|\ "

print "| / "

print "| "

else:

print "________ "

print "| | "

print "| 0 "

print "| /|\ "

print "| / \ "

print "| "

print "The noose tightens around your neck, and you feel the"

print "sudden urge to urinate."

print "GAME OVER!"

self.__init__()

def progress_updater(self, guess, the_word, progress):

i = 0

while i < len(the_word):

if guess == the_word[i]:

progress[i] = guess

i += 1

else:

i += 1

return "".join(progress)

游戏=刽子手()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值