#!/usr/bin/python ## ## Simple web game by William D. Colburn ## http://infohost.nmt.edu/~schlake/ ## 505 480 9406 ## schlake@nmt.edu ## import cgi import cgitb import os import sys import random def out( msg ): print msg, '

' def getField( field ): if form.has_key( field ): try: return int(form[field].value) except: return form[field].value return None ######################################################################## cgitb.enable() print 'Content-Type: text/html\n' # not an out() print 'Dating Simulation Game' print '

Dating Simulation Game

' form = cgi.FieldStorage() score = getField( 'score' ) decline = getField( 'decline' ) ask = getField( 'ask' ) accept = getField( 'accept' ) nothing = getField( 'nothing' ) if not score: score = 0 if accept: if random.randrange( 0, 10 ) == 10: print 'You go on a date! You win!' sys.exit(0) else: print 'She stands you up.

' score = score - 8 if decline: print 'You turn her down.

' score = score - 2 if ask: if random.randrange( 0, 10 ) == 10: print 'You go on a date! You win!' sys.exit(0) else: if random.randrange( 0, 100 ) == 0: print 'She accepts! But stands you up.

' score = score - 16 else: print 'She turns you down.

' score = score - 4 if nothing: print 'You do nothing.

' score = score - 1 if score < -250: if random.randrange( 0, 5 ) == 0: print 'You have died of excessive masturbation.

' else: print 'You have died of lonlieness.

' sys.exit(0) print 'Current Score:', score, '

' if random.randrange( 0, 25 ) == 0: print """ A cute single girl asks you out!

""" % score else: print """ You meet a cute single girl you could ask out.
""" % score