Poem Generator

I recently posted a question on @PaigntonPoet asking if any young people would be interested in modifying a program to create a random poetry generator.

As I seem to have a collection of programs I decided to make a start,  and combine the Magic 8 ball program with the note pad program I created a while back.

mnagic8 + 3 buttons

tuxpaint

 

poem_generator

 

At present I have added an extra menu item that calls up the random response generator 4 times.

Looking at the poems on the above twitter page a simple poem seems to comprise of 4 lines,  the 2nd and last line rhyme as in have similar sounding words at the end.

So what is needed is a way to create 2 sets of lines, then call these up in the right way so that a poem is generated based on the rules above.  But being random may not always make sense.

If I get the code right then I can leave the lines of poetry to the experts. 🙂

For the new IT computer science curriculum doing this ties in with English but also possibly covers.

Key Stage 1

KS 1:1 understand what algorithms are, how they are implemented as programs on digital devices, and that programs execute by following precise and unambiguous instructions
KS 1:2 create and debug simple programs
KS 1:3 use logical reasoning to predict the behaviour of simple programs
KS 1: 4 use technology purposefully to create, organise, store, manipulate and retrieve digital content

and for Key State 2

KS 2:2 use sequence, selection, and repetition in programs; work with variables and various forms of input and output

 

The raw code can be found here

https://raw.githubusercontent.com/zleap/compgroup/master/gui_demos/poem_generator.py

if you copy / paste in to a file, save this file as a .py file then run in the usual way.  you need the python-tk module for this

Note this is very early ALPHA.

 

 

One thought on “Poem Generator

Comments are closed.