Showing posts with label poetry. Show all posts
Showing posts with label poetry. Show all posts

Thursday, 2 October 2014

Coding and Poetry

It's National Poetry Day, apparently, so I thought I should finally tie up the loose ends from the COBOL poem I posted the other week.  Loose ends like what on earth possessed me to write a poem in COBOL...

It all started with a blog post from Girl on the Net, detailing the filthy things she'd like to do to programmers (link probably NSFW, needless to say).  More power to her elbow, I say, though since I work in an open plan office none of the things she's thinking of would be even remotely feasible.

Anyway, that was where it started.  Following on from that, via the magic of Twitter, I found myself reading an elderly article about poetry in Perl.  And this is where the trouble started.  That article makes a couple of snarky comments about COBOL, like "getting a volunteer to write poetry in COBOL is likely to be impossible."  So what was I supposed to do?  Just let it pass?  No, I couldn't really ignore the gauntlet that had been thrown down, even if it was a gauntlet that only I could see.  So I sat down, and I wrote a COBOL poem, and I posted it on here.  And then I sent it to Girl on the Net and the individual who'd linked to the Perl article, just because.

Don't worry, I'm not about to announce that I've now compiled an entire anthology of poems in COBOL, or in other obscure programming languages.  Though I did write a haiku in Spectrum BASIC while messing around on Twitter:

10 PRINT "Forever"
20 PRINT "I will love you"
30 GOTO 10

Anyone who bothered to look at the comments on the COBOL poem, however, will have seen that I was challenged to write something using Inform 7.  Something that would work as a code poem and as a piece of interactive fiction.  In the end, I wrote two.  Sort of.

See, although Inform 7 is practically English anyway, it's still code.  And it's code designed for a very specific job.  The closest I got to actual poetry in the code wasn't a very good piece of IF; you can examine a couple of things and there's a single command that allows you to win, and that's it.  Otherwise you just expire after about five turns.  It's very poetic and lovely, but it's a bit rubbish to actually play.  The other one managed to be slightly (but only slightly) more engaging as IF, but wasn't much cop as poetry as a result.  To make good IF you need to build a rich environment and then nail down absolutely everything the player might consider doing; poetry works better when you skirt around the edges and hint at things.

So I shan't be posting the results, as interesting a challenge as it was.  They were sent to my challenger, as proof that the challenge had been completed (and since he didn't write anything I win by default!), but they won't be seeing the light of day as poems.  Maybe as IF, if I work on them a little more someday.  Or maybe I'll write something else instead.

You are in a maze of twisty little passages, all alike...

Thursday, 11 September 2014

COBOL Poetry

 IDENTIFICATION DIVISION.
 PROGRAM-ID. POETRY.
*
***********************************************************************
* THIS IS WHAT HAPPENS WHEN I READ ABOUT PEOPLE WRITING POEMS IN PERL *
* AND THE ARTICLE SUGGESTS NO ONE WOULD EVER WRITE ONE IN COBOL       *
*            CHALLENGE ACCEPTED!                                      *
***********************************************************************
*
 ENVIRONMENT DIVISION.
*
 DATA DIVISION.
 WORKING-STORAGE SECTION.
*
 01 WONDER-IF-YOU-LOVE-ME  PIC X(1).
      88 YOU-LOVE-ME         VALUE 'Y'.
      88 YOU-LOVE-ME-NOT     VALUE 'N'.
*
 01 MY-BEST-SIDE  PIC X(40) 
                  VALUE 'ALL NEUROSES HIDDEN SO YOU WILL LOVE ME.'.
*
 PROCEDURE DIVISION.
*
 HOW-TO-MAKE-YOU-LOVE-ME.
*
     IF YOU-LOVE-ME
        CONTINUE
     ELSE
        PERFORM TO-WIN-YOUR-LOVE
     END-IF
*
     GOBACK.
*
 TO-WIN-YOUR-LOVE.
*
     PERFORM UNTIL YOU-LOVE-ME
        DISPLAY MY-BEST-SIDE
     END-PERFORM
*
     EXIT.
*