data-workers-publication/create_backcover.py
2019-03-25 08:35:09 +01:00

51 lines
1.3 KiB
Python

from math import log
import random
from functions import insert_linebreaks
groups_left = ['humans', 'humans', 'machines', 'machines', 'humans', 'machines', 'machines', 'humans']
groups_right = ['humans', 'machines', 'machines', 'humans', 'machines', 'machines', 'humans', 'humans']
verb = 'learn'
relations = ['from', 'with']
symbols = ['', '', '', '', '', '']
def create_backcover(steps=1):
linewidth = 110
lines_per_page = 70
maximum = 100
tmp = ''
for i in range(1, maximum):
tmp += random.choice(symbols)
tmp += ' '
tmp += groups_left[i % len(groups_left)]
tmp += ' '
tmp += verb
tmp += ' '
tmp += relations[i % 2]
tmp += ' '
tmp += groups_right[i % len(groups_right)]
tmp += ' '
tmp += random.choice(symbols)
tmp += ' ' * int(log(i) + 5)
for i in reversed(range(1, maximum)):
tmp += ' ' * int(log(i) + 5)
tmp += random.choice(symbols)
tmp += ' '
tmp += groups_left[i % len(groups_left)]
tmp += ' '
tmp += verb
tmp += ' '
tmp += relations[i % 2]
tmp += ' '
tmp += groups_right[i % len(groups_right)]
tmp += ' '
tmp += random.choice(symbols)
out = insert_linebreaks(tmp, linewidth)
out = '\n'.join(out.split('\n')[:lines_per_page]) # select the lines to fill one page
return out + '\n'
# print(create_backcover(steps=1))