Commit 6f89dcea authored by ana's avatar ana
Browse files

updating oulipo scripts

parent 41c6b250
#!/usr/bin/env/ python
# This script rewrites the novel by replacing the name of the principal
# character in the novel by another name.
# It writes the new version of novel to a file called starring_me.txt and to a Logbook in Context
# The idea for this script comes from the book 'Think Python'.
# Copyright (C) 2016 Constant, Algolit, An Mertens
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details: <http://www.gnu.org/licenses/>.
import colors
from colors import red, green, yellow, blue, magenta, cyan, bold, underline
import time
import os, sys
## FUNCTIONS
# print on screen character per character
def typewrite(sentence):
words = sentence.split(" ")
for word in words:
for char in word:
sys.stdout.write('%s' % char)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.write(" ")
sys.stdout.flush()
# write to file
def archive(sentence):
with open("novel_starring_you.txt", "a") as destination:
destination.write(sentence)
# loop script
while True:
# introduction, getting the variables
print("\n\t\tDear visitor, we will rewrite the opening scene of ", green("Kurt Vonnegut's 2BRO2B"), " using your name and favourite city.\n")
#time.sleep(2)
first_name = input("\t\tPlease type your first name: ")
#time.sleep(2)
last_name = input("\n\t\tPlease type your last name: ")
#time.sleep(2)
country = input("\n\t\tChoose a country: ")
#time.sleep(2)
city = input("\n\t\tChoose a city in that country: ")
#time.sleep(2)
print("\n\t\tDo you want to be", green('female'), "or", green('male?'))
gender = input("\t\tPlease type f or m: ")
#time.sleep(5)
print("\n")
# specify input text
source = open("vonnegut.txt", "r")
sentences =[]
# write & replace
archive("\n\nNovel Starring You\n")
archive("-------------\n\n")
with source as text:
for line in text:
line = line.replace("the United States", country)
line = line.replace("Chicago", city)
line = line.replace("Edward K.", first_name)
line = line.replace("Wehling", last_name)
if gender == 'f':
line = line.replace(" man ", " woman ")
line = line.replace(" man,", " woman,")
line = line.replace(" his ", " her ")
line = line.replace(" him ", " her ")
line = line.replace(" His ", " Her ")
line = line.replace(" wife ", " husband ")
line = line.replace(" he ", " she ")
line = line.replace(" He ", " She ")
typewrite(line)
archive(line)
# break before relaunching the script
time.sleep(10)
Everything was perfectly swell.
There were no prisons, no slums, no insane asylums, no cripples, no poverty, no wars.
All diseases were conquered. So was old age.
Death, barring accidents, was an adventure for volunteers.
The population of the United States was stabilized at forty-million souls.
One bright morning in the Chicago Lying-in Hospital, a man named Edward K. Wehling, Jr., waited for his wife to give birth. He was the only man waiting. Not many people were born a day any more.
Wehling was fifty-six, a mere stripling in a population whose average age was one hundred and twenty-nine.
X-rays had revealed that his wife was going to have triplets. The children would be his first.
Young Wehling was hunched in his chair, his head in his hand. He was so rumpled, so still and colorless as to be virtually invisible. His camouflage was perfect, since the waiting room had a disorderly and demoralized air, too. Chairs and ashtrays had been moved away from the walls. The floor was paved with spattered dropcloths.
The room was being redecorated. It was being redecorated as a memorial to a man who had volunteered to die.
A sardonic old man, about two hundred years old, sat on a stepladder, painting a mural he did not like. Back in the days when people aged visibly, his age would have been guessed at thirty-five or so. Aging had touched him that much before the cure for aging was found.
The mural he was working on depicted a very neat garden. Men and women in white, doctors and nurses, turned the soil, planted seedlings, sprayed bugs, spread fertilizer.
Men and women in purple uniforms pulled up weeds, cut down plants that were old and sickly, raked leaves, carried refuse to trash-burners.
Never, never, never—not even in medieval Holland nor old Japan—had a garden been more formal, been better tended. Every plant had all the loam, light, water, air and nourishment it could use.
A hospital orderly came down the corridor, singing under his breath a popular song.
The orderly looked in at the mural and the muralist. "Looks so real," he said, "I can practically imagine I'm standing in the middle of it."
"What makes you think you're not in it?" said the painter. He gave a satiric smile. "It's called 'The Happy Garden of Life,' you know."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment