User:Clara/Project: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 38: Line 38:
</source>
</source>
<pre>
<pre>
Output example:
Outputs:
On a cold evening
On a cold evening
Appeared a dog and a pen
Appeared a dog and a pen
Line 46: Line 46:
Hoping to feel happier
Hoping to feel happier
And so the day started
And so the day started
On a gloomy day
Appeared a dog and a tree
They found themselves in a parking lot
The dog had brought a flag
They were there to protest
Hoping to make a difference
And so the day continued
</pre>
</pre>

Revision as of 16:51, 12 October 2021

Publication generator

On the topic of fables, short stories, one liners. Generating randomised morals that teach us something.

Creating structure

Workshop at leeszaal

Coding generative stories

intro = ("sunny day", "day unlike an other", "cold evening", "gloomy day")
character = ("cat", "pen", "dog", "tree")
characters = ("cat", "pen", "dog", "tree")
location = ("parking lot", "sauna", "school")
object = ("flag", "ladder", "banana", "lunchbox")
action = ("protest", "study", "get therapy")
moral = ("make a difference", "learn from each other", "feel happier")
end = ("ended", "continued", "started")

import random

i = random.choice(intro)
c = random.choice(character)
h = random.choice(characters)
l = random.choice(location)
o = random.choice(object)
a = random.choice(action)
m = random.choice(moral)
e = random.choice(end)

for x in range (1):
    print(f"On a {i}")
    print(f"Appeared a {c} and a {h}")
    print(f"They found themselves in a {l}")
    print(f"The {c} had brought a {o}")
    print(f"They were there to {a}")
    print(f"Hoping to {m}")
    print(f"And so the day {e}")
Outputs:
On a cold evening
Appeared a dog and a pen
They found themselves in a school
The dog had brought a lunchbox
They were there to get therapy
Hoping to feel happier
And so the day started

On a gloomy day
Appeared a dog and a tree
They found themselves in a parking lot
The dog had brought a flag
They were there to protest
Hoping to make a difference
And so the day continued