Skip to content

Instantly share code, notes, and snippets.

Created March 5, 2014 21:59
What would you like to do?
#MonthOfCode day 4 - error
# imports the sleep function; it will add some suspense
from time import sleep
import random
score = 0
reasonable_player = False
print '*** tough guy simulator ***'
invite_msg = 'so you want to play the russian roulette, hu?'
while(not reasonable_player):
# this inner loop aims at validating the answer
valid_answer = False
while(not valid_answer):
print invite_msg,'y/n'
answer = raw_input()
if( not ('y'==answer or 'n'==answer)):
print 'answer y or n, come on!'
print 'you press the trigger, slowly...'
sleep( 1) #waits 1sec
# 6-bullets revolver simulation
if( random.choice( range(1,6)) == 1):
print '*BAM*!'
raise Exception('FATAL ERROR!')
print '*CLICK* nothing happens. Jesus.'
score += 1
invite_msg = 'want more thrill, though guy?'
# displays score + comment
comment = (
'Grow some balls, man!' if (score<3) else (
'Not bad, I respect that!' if (score<5) else (
'Hail to the king! You freak!'
print 'you achieved a score of:',str(score)+'.',comment
Copy link

I think a rm -rf is missing somewhere ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment