#!/usr/bin/python #Story generation by elision & addition #Nick Montfort & Beth Cardier #2008-11-29 from random import choice, shuffle while True: s=["It's Tommy's birthday","Mother works on a special meal",'Tommy loves salmon','Rufus the pup smells something in the next room','The phone rings','Mother steps away to answer the phone','The dog leaps onto the counter','Rufus grabs the prize','Mother screams','Tommy runs from his room','Tommy chases Rufus','Rufus swallows the fish in two bites','Rufus wags his tail','Tommy cries','Mother kicks Rufus','Tommy screams','Tommy runs outside holding Rufus'] a=['A cloud darkens the sky','Far away, the superpowers argue','A truck hums along','The newspaper slaps the front door','A shirt sails off a line','The sky is clear and blue','A bicycle bell rings','A lawnmower sputters'] shuffle(a) l=choice(range(5,9)) while len(s)>l: s.remove(choice(s)) print "\nHere's the story:" for t in s: print t+'.' if choice([0,1]): print a.pop()+'.' raw_input('The end.')