Skip to content

Instantly share code, notes, and snippets.

@samplereality
Created June 28, 2014 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samplereality/d82f5c2d8abe2b5d45cd to your computer and use it in GitHub Desktop.
Save samplereality/d82f5c2d8abe2b5d45cd to your computer and use it in GitHub Desktop.
Nick Montfort's "Through the Park" short story generator
#!/usr/bin/python
# Through the Park, copyright (c) 2013 Nick Montfort <nickm@nickm.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import random, textwrap
for i in range(0, 8):
text = ["The girl grins and grabs a granola bar",
"The girl puts on a slutty dress",
"The girl sets off through the park",
"A wolf whistle sounds",
"The girl turns to smile and wink",
"The muscular man paces the girl",
"Chatter and compliments cajole",
"The man makes a fist behind his back",
"A wildflower nods, tightly gripped",
"A snatch of song reminds the girl of her grandmother",
"The man and girl exchange a knowing glance",
"The two circle",
"Laughter booms",
"A giggle weaves through the air",
"The man's breathing quickens",
"A lamp above fails to come on",
"The man dashes, leaving pretense behind",
"Pigeons scatter",
"The girl runs",
"The man's there first",
"Things are forgotten in carelessness",
"The girl's bag lies open",
"Pairs of people relax after journeys and work",
"The park's green is gray",
"A patrol car's siren chirps"]
phrases = 7 + random.randint(0,4)
while len(text) > phrases:
text.remove(random.choice(text))
print "\nThrough the Park [" + str(i+1) + "]\n\n" + \
textwrap.fill(". ... ".join(text) + ".", 60) + "\n\n\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment