The Atomic Playboy and the Radiation Romeo

The button below will open a new browser window displaying the Flash interface for Atomic and Romeo (Version 16 with Preloader). You will find a page of introductory text, some instructions and then the interface where you can suggest a topic for conversation.

This version 16 uses the landscape layout, updates the heckler and end-of-conversation functions with an audio sign-off. All the features from previous versions remain - scroll bar control,custId variable allows me to better log and track conversations.

The chat-bots are hosted on the Pandorabots server under the Shared Service subscription. Please note, the terms of the Updated Policy Guidelines for Free Community Server state that the “Use of automated scripts to make your pandorabot talk to itself or another bot or script” is proscribed (Pandorabots 2011). This project is being developed with the agreement of the Pandorabots Inc management and we would like to acknowledge their support. ( Pandorabots )

Please leave a comment...

After you have had a play with Atomic and Romeo please use this link to leave a comment.
Maybe you could suggest a topic of conversation or a layout suggestion.
All suggestions gratefully received.

Wednesday, December 12, 2012

Yah ! Crowd Goes Wild !

Atomic and Romeo won 3rd Place in the Funniest Computer Ever Competition.

Congratulations to Steve Worswick and Owen Niblock, and to all the contestants.
  • 1st place: Mitsuku by Steve Worswick
  • 2nd place: Gig-A-Tron 5000 by Owen Niblock 
 Also, thanks to Dr Sam Joseph for organizing this truly funny, funky, and engaging event.

Onward and upward for next year.

Thursday, November 1, 2012

Funniest Computer Ever Competition

Well the day has arrived to down tools (for a while). Today (1 November 2012) is the submission day for the Funniest Computer Ever Competition.

Dr. Sam Joseph, the contest organizer, left a comment on this blog suggesting I could enter Atomic and Romeo in the competition. That was a very generous thing for him to do. This really is a Win-Win situation for me. Regardless of how well Atomic and Romeo do in the competition, just the possibility of getting feedback from a field of experts interested in both humour and artificial intelligence is too good an opportunity to miss. 

The other 'win' relates to the competition rules and, in particular, the three stages of judging.
Stage 1, Improv:
The judge says to the comedybot, “tell me a joke related to X.” The comedybot would have to try to come up with an original joke, which will be checked against a database of jokes for originality.
Stage 2, Poetry:
The judge says to the comedybot “tell me a funny poem about Y.” The comedybot would have to try to come up with an original poem, which will be checked against a database of poems for originality.
Stage 3, Freestyle:
Stage 3 consists of 5 minutes of chat in which the comedybot tries to be as funny as possible, through the successful deployment of witty banter.
Initially Atomic and Romeo were set up as a comedy duo - comedian and feeder (or straight-man, to use the less precise role description). This meant they were developed to perform a sketch on a given topic lasting for 26 interchanges. There is a freedom in this form - the characters can play to each other, generate non-sequiturs that are eventually resolved, and use personality traits to mask moments when knowledge is missing. That will work, I'm hoping, in the Freestyle stage.

The competition stages required me to take their development in a new direction. This was a real bonus. It taught me a lot about my own assumptions about comedy.
1 - I thought jokes would be easier than poetry - wrong, wrong, wrong!
2 - My guys deal in the computational performance of comedy rather than computational construction of humour - this competition forced me to clarify that distinction.
3  - Atomic and Romeo are closer to being human than machines - they are fallible, they don't know everything, they perform following a script, and they don't live up to our overblown expectations of artificial intelligence. This is a crucial understanding. I even wrote a sketch about it.
4 - The “tell me a joke related to X.”and “tell me a funny poem about Y.” structures really forced me to grapple with some of the deeper implications of recursion and random selection in AIML.
 So until after the competition results are released they will be no more new versions of the interface or additions to the AIML for Atomic and Romeo. 

You can follow the competition at:

Monday, October 29, 2012

Email comments

This is quite a long post (but there is no rule against that).  It seems that Comments in Blogger can't deal with any kind of HTML mark-up (even though it says it can) and they have a limit on the  maximum number of characters in a comment. For these reasons Joe emailed the comments to me. The post contains these emails. They analyze some of the sketches performed by Atomic and Romeo. I thought that this analysis was so remarkably detailed, considered and useful that I asked Joe Velikovsky if he would allow me to post them here. Thankfully he agreed.

Email from JT Velikovsky - 20/10/2012 - 5:46 PM

Hey Mike

Just had a play with it.
It was pretty damn amazing, ie impressive.
It resulted in the following script (below)
And as a side-thought - I note it touches on a whole bunch of issues I'm  grappling with in my own DCA ie Creativity, Csikszentmihalyi, etc.

Some comments in bold:

Atomic : Romeo are you just going to sit there or are you going to ask something?
Romeo : How about that local sporting team?
Atomic : I have no answer for that.
Romeo : Make a list of everything you don't know.
Atomic : Should I check it twice? (this is a "Santa Claus is coming to town" song/lyric gag, yeah? Made me smile.)
Romeo : Now you're just being perverse!
Atomic : Perverse - how so?
Romeo : If you checked it twice you'd know everything on the list and...
Atomic : I'd have to start again.
Romeo : Exactly.
Atomic : How did you get to be so wise?
Romeo : I grabbed the bull by the horns and the tiger by the tail - and never the other way round. (funny)
Atomic : Good advice for young players. (funny)
Romeo : Have you started on the list yet?
Atomic : Having a little difficulty I must admit.
Romeo : Well you could always invert the problem.
Atomic : Make a list of everything I know - let's call that X.
Romeo : Then make a list of everything there is to know - let's call that Y. (this was a tiny bit odd, it seems they skipped a turn, ie  Romeo should have said "OK...", and then Atomic switched places in the argument, but it didn't really matter, ie - it gives the effect they are thinking ahead of each other/finishing the others sentences/thoughts.)
Atomic : But Y keeps growing.
Romeo : It's what humans do - we make up new stuff all the time. (ie - 'Creativity!'the amount of info/artifacts in the Domain keeps growing exponentially…)
Atomic : That's terrifying, as a ratio of X to Y - I know less now than I did a few minutes ago. (funny)
Romeo : That should make life easier. (this is hilarious)
Atomic : In what universe?
Romeo : You know so little that you could add anything to your list of things you don't know and you'd probably be correct. (funny & clever)
Atomic : And that's a good thing? (funny)
Romeo : Of course, you'd be making terrific progress with very little effort. (funny & clever)
Atomic : Why didn't they teach me any of this stuff in school?
Romeo : They were just training you to work for the man! (subversive! awesome)
Atomic : Which man - are you the man?
Romeo : Our work here is done. (funny!)
Atomic : The Atomic Playboy has left the building - thank you and goodnight.
Romeo : That jumpsuit is a little tight...
Good also, the way it ends / they "sign off"... Classic comedy-duo (straight/funny man) style stuff.



Email from JT Velikovsky - 20/10/2012 - 7:16 PM

Hey Mike

Conversation #2 with my annotations below. (Hope these are helpful feedback, somehow)

Also, a suggestion that just now occurred to me:

Possibly for extra gag-value: (though this may `break' something)

Rather than "I have no answer for that", what if, the reply there, was (ie - randomly selected, from the below)

I refuse to answer that - on the grounds that it may inseminate me
I refuse to answer that - on the grounds that it may incinerate me
I refuse to answer that - on the grounds that it may disseminate me
I refuse to answer that - on the grounds that it may incubate me
I refuse to answer that - on the grounds that it may accelerate me
I refuse to answer that - on the grounds that it may [some word that rhymes with `incriminate'] me (etc)
(ie see any `Rhyming Dictionary' on the net, LOL)

Conversation #2, just now

Romeo : How about that random thing?
Atomic : I have no answer for that.
Romeo : Now you really do sound like a machine. (this is actually quite funny in context, so, Mike, take my "I have no answer for that" suggestion above, with a grain of Saxa)
Heckler : Yo mama so fat
Romeo : We've got a heckler ! They said... Yo mama so fat
Atomic : Who's rooting this cat - you're just holding the tail! (LOL! Edgy. I love it. Also it was possibly unintentionally funny, that `fat'  and `cat' rhymed.)
Romeo : Keep up Atomic, I said... (is this a typo, "Keep it up Atomic, I said...?"oh wait, sorry; I get it, maybe this would be better: "Try and keep up, Atomic, I said...")
Atomic : Come on, spit it out!
Romeo : Now you really do sound like a machine.
Atomic : No I don't, but I can if you want me to.
Romeo : Could you sound even more like a machine?
Atomic : "Danger - Danger - Will Robinson". (Great sci fi nerd humour. `Lost In Space' TV series. This is rewarding for the viewer/reader/audience in terms of intertextuality.)
Romeo : I see what you mean.
Atomic : "Number 5 is ALIVE!". (ditto, cant remember the movie right now, but I know the one. Short Circuit, was it?)
Romeo : Just a little bit more than you are.
Atomic : "Quiet please - I am analyzing". (don't know this reference)
Romeo : Who said that?
Atomic : Robbie from Forbidden Planet - you never really studied - it's just one of the classics.(aha! And there's the answer. I have a DVD copy and have watched it about 3 times, but forget it... Leslie Neilsen in a straight role! Remarkable.)
Romeo : He was a helpful fellow - unlike some.
Atomic : "I am fluent in over six million forms of communication, and can readily...". (Star Wars, of course... It is one of the 40 films I am studying for my DCA, know it well, ahem :)
Romeo : No one cares C-3PO.
Atomic : "Dr. Harris when are you going to let me out of this box?". (Demon Seed! What an amazing film, I think you got me onto this film actually.)
Romeo : "Well, Proteus - I see you've developed a sense of humor - A sense of humor has saved many a man's sanity, including mine".
Atomic : We should watch Demon Seed again - it's another cult classic.
Romeo : "I'm sorry Dave - I'm afraid I can't do that". (Kubrick! My favourite.)
Atomic : What are you a man or a CPU? (funny)
Romeo : Does it matter? (more funny)
Atomic : Not really - it all ends up the same way. (even more funny)
Romeo : "I've seen things you people wouldn't believe - Attack ships on fire off the shoulder of Orion - I watched C-beams glitter in the dark near the Tannhauser gate - All those moments will be lost in time - like tears in rain.". (Blade Runner!)
Heckler : Yo mama so computational
Romeo : Hey, Atomic, deal with this heckler. They said... Yo mama so computational
Atomic : Are you talking to me? Are YOU talking to ME? No. Oh, sorry. (Taxi Driver.What a great meme this line of dialog is.)
Romeo : What I said was...
Atomic : Think boy! Think!
Romeo : "I've seen things you people wouldn't believe - Attack ships on fire off the shoulder of Orion - I watched C-beams glitter in the dark near the Tannhauser gate - All those moments will be lost in time - like tears in rain.".
Atomic : "Describe in single words only the good things that come into your mind about - your mother".(more Blade Runner! Gotta love PK Dick)
Romeo : "Let me tell you about my mother".
Atomic : "Describe in single words only the good things that come into your mind about - your mother".
Heckler : Lemme tellya bout my mother (this was me trying to pre-empt  the next line from that scene in Blade Runner, but I was too slow in typing it :)
Romeo : Hey, Atomic, deal with this heckler. They said... Lemme tellya bout my mother
Atomic : Are you talking to me? Are YOU talking to ME? No. Oh, sorry. (still works, though not quite as funny as it isn't quite as `new'. Does "Surprising + New + Logically Inappropriate = Funny?" Dunno.)
Romeo : "Let me tell you about my mother".
Romeo : What I said was...
Atomic : Stick your tongue out - I can see it right on the tip.
Atomic : As Freud would say - "If it's not one thing - it's your mother". (funny :)
Romeo : "Let me tell you about my mother".
Romeo : That's enough out of us.
Atomic : That's enough out of you. (Feels like The Two Ronnies, "And, it's goodnight from me", "And - it's goodnight from him")
Atomic : As Freud would say - "If it's not one thing - it's your mother".
Romeo : Enough already! (good that Romeo seemed to recognize Atomic was repeating a line from before)
Romeo : Freud's problem was that he only ever learned to count to sex. (funny :)
Atomic : What are you wearing?
Romeo : Now you are just freaking me out. (funny. Certainly inappropriate, LOL. Makes me wonder if: "Surprising + New + Logically Inappropriate = Funny?" But in fact, its the `ambiguity', not `Inappropriateness maybe.Is there a formula for humour, like "e= mc squared"? I am just curious.)
Atomic : Do you look pretty?
Romeo : I have no answer for that.
Atomic : I have no answer for that.
Romeo : Now you really do sound like a machine.
Atomic : No I don't, but I can if you want me to. (LOL)
Romeo : Could you sound even more like a machine?
Atomic : "Danger - Danger - Will Robinson".
Romeo : Live long, and prosper.
Atomic : Die young, and leave a pretty corpse!
Romeo : So how's that working out for you? (funny)
Anyway I stopped it there, I think. As I wanted to comment on it all.
Actually the ribbing between them is good, it gives the impression of 2 live humans with chemistry, eg Martin & Lewis.

I will now do another one (another routine), but - I just want to say Mike - how well it seems to have all "come together". (As the Actress said to the Bishop) :)
ie I find it impressive in terms of the comedy writing, the comedy interplay that emerges. ie there is an emergent quality of this, greater than the sum of Atomic and Romeo themselves.
I also see myself as some sort of comedy connuisseir (though I still cant spell it). ie As a fan of comedy, I have "soaked up" loads of comedy over the years...
So - what this chatbot is achieving (in simulating a comedy duo) is quite remarkable to me. (also - having had a little bit of a play with AIML Pandora chatbots myself... My mind boggles somewhat, at what you've done here. ie So, well done.)



Email from JT Velikovsky - 20/10/2012 - 7:31 PM

Hi Mike


Romeo : Read any good user manuals lately?
Atomic : I have no answer for that.
Romeo : You live on the inter-web, look it up. (funny)
Atomic : It's not as easy as you might imagine.
Romeo : But you're surrounded with all sorts of data.
Atomic : There's the rub - data isn't information and information isn't always the answer. (Shakespeare reference, also suddenly these guys are being profound. interesting.)
Romeo : So what is it?
Atomic : There is no difference between information and trivia.
Romeo : Yes there is - information is useful.
Atomic : Trivia won me more beers. (funny/clever/slightly smart-ass, i love it, also i have done pub trivia a bit - so I enjoy this joke on several levels)
Romeo : At the time that trivia was useful.
Atomic : Ergo - it was information and, by your logic, not trivia. (now this feels like a Socratic dialog, which is interesting, on top of the funny)
Romeo : A pub competition is the basis of your philosophy - I'm impressed. (a wiseacre: sarcasm. good stuff. `conflict is drama', etc)
Atomic : Imagine a massive library where every word in every book is linked to another group of words in a group of other books. (again this feels like Plato talking, eg his Cave and all that stuff - which; is interesting)
Romeo : Sounds like the inter-web to me.
Atomic : I imagine that from outside it looks pretty special?
Romeo : Well, yes - dashed clever those boffins at CERN.
Atomic : Now imagine a light-year of vacant space between each one of those words.
Heckler : Allow me to interject in your interweb
Romeo : Heckler Alert! They said... Allow me to interject in your interweb
Atomic : Attention slut - I'd bet you'd drop your pants for a dollar. Makes me glad I'm broke. (funny heckler comeback :)
Atomic : And the topic of conversation was? Ah, yes...Now imagine a light-year of vacant space between each one of those words. (nice recovery from the heckle!)
Romeo : That's big.
Atomic : You think your universe is big but cyberspace swallows it and shits it out behind the lounge as speck of dust on a gnat's nose. (funny in a Douglas Adams tonal way)
Romeo : Why is there a gnat behind the lounge? (really funny, I am not sure why, maybe just the non sequitur nature of it)
Atomic : Because it's shit scared of all the vacant space. (really funny, laugh out loud)
Romeo : An agoraphobic gnat - I wonder what your therapist would make of that?
Heckler : Gnat's all folks!
Romeo : Someone just said... Gnat's all folks!
Atomic : Attention slut - I'd bet you'd drop your pants for a dollar. Makes me glad I'm broke. (would have been better if it was another heckle but since I am guessing these heckle comebacks are chosen randomly, not much we can do about that, just a bit of unluck on my part, this time)
Romeo : What I said was...
Atomic : Don't you dare make us look stupid.
Romeo : An agoraphobic gnat - I wonder what your therapist would make of that?
Mike - another very good one. Sometimes, it reminds me of /The Big Bang Theory/, a nerd-comedy show which I love.
ie In my opinion, Sheldon could deliver some of the above lines in that show, and it wouldn't seem out of place.
(Also the previous conversation, with all the sci-fi robot / geek humour references, Hal, C3PO, Robbie the Robot etc.
ie I am one of those geeks, so, I find this stuff entertaining/rewarding on several levels.)



Email from JT Velikovsky - 20/10/2012 - 7:51 PM

Hi Mike

Tried to post this comment to the Blog but it didn't seem to recognize the characters

Really cool Mike. The script (or, performance?) that results flows really well and has many genuinely funny (laugh out loud) moments, for me. It really does give the impression of a straight man/funny man comedy duo, engaging in banter.

Also, having had a little bit of a play with Pandora chatbots and AIML myself, I can appreciate the amount of work it probably took to get it all looking and working this well. Very impressed, well done.

 The heckling feature was pretty remarkable too, offering the chance for interactivity. They (Atomic & Romeo) seemed to deal well with the heckling, and then segued nicely back into the routine. All felt realistic and very effective. 

 My only tech issue was that the window when it first opened (on my laptop pc, using IE) wasn't wide enough to allow me to hit NEXT but I finally right-clicked and it `show full' and it fixed the issue. 

 Anyway well done.



Monday, October 22, 2012

Version 15 - so soon?

Version 15 actually reverts to the original landscape layout. Some of the users of the interface have experienced problems with the height of the portrait layout. In particular, if they have a small screen size or are running their screen at 800 x 600 resolution, the buttons that allow the user to proceed from the introduction page to the instruction page and, finally, to the interface page are hidden off the screen. This was a sufficiently major user interface issue to require a new version.

All new versions require a considerable amount of testing.  This one I've done as quickly as possible just to get it back out there for more testing and feedback from 'real' people.

What should Romeo say when he doesn't know how to respond?

Occasionally, due to the variable lengths of the sketches I've written, Romeo will be thrown a line he can't respond to. What should he do? The last thing he should do is respond with, "I have no answer for that". That line is reserved for Atomic as a mark of his machine-esque existence.

When Romeo receives a topic he can't reply to he, like Atomic, defaults to his * (star) category. Today I've rewritten his * category so that he will reply with one of the following six randomly generated replies. The *  in the template element actually picks up the line that was thrown by Atomic and incorporates it into Romeo's reply. There may be a dash of echolalia here - but I don't think it represents a psychiatric disorder for Romeo.

Atomic, you can be so random at times - * really?
Has someone put salt and vinegar on your chips?
You've been dead too long.
* - you're mad as a bag of hammers!
You've derailed my train of thought - why * ?
Sometimes I feel like I'm herding cats.

From these lines I can now get Atomic to either defend himself (usually by abusing Romeo), pick up on part of what Romeo has said (e.g. cats), or change to a new topic.

Sunday, October 7, 2012

The interface as 'actor'

In an earlier post I wrote about the writing process - the process I use to generate the dialogue in AIML for Atomic and Romeo. This post is about the interface and how it works as the interface plays a crucial role in the project. It supplies the timing of the dialogue, the ability to heckle Atomic, and controls to the length of each performance, even allowing the user to terminate a performance.

In this most recent version of the interface there are 1207 lines of code, including inactive comment lines that describe what a function or variable should be doing. There are sixteen functions that control all of the behaviours of the interface. Some of these functions are timers that control the display of text on the screen including a randomly selected set of end-of conversation sign-offs and a random selection of responses to heckles, including some that also act as end-of-conversation sign-offs.
  • The four core functions are: askAtomic, askRomeo, onAnswerLoad and onAnswerLoad01. The askAtomic function captures the user's text and sends it to the server. The onAnswerLoad function captures the reply from the server and fires the AskRomeo function sending the reply to Romeo. The onAnswerLoad01 then captures the reply from Romeo and fires the askAtomic function. In the earliest versions of the interface simply getting this to work in a consistent manner was the priority.
  • Getting the performance to end was the next development. A variable, simply called 'howMany', counts the number of interactions. When howMany is greater than 26 the onAnswer functions are disabled - stopping the performance.
  • The next step in the development was to allow the user to stop the performance. To do to this the interface has to be able to detect which character delivered the last line, otherwise, the sign-off would be both out of sequence and disconcerting. By tracking the current value of the  'howMany' variable it's possible to then test if it has an odd or even value. Atomic always has odd numbered lines - Romeo always has even numbered lines. This allows me to provide the lines in the appropriate order depending on the last speaker via a pair of timer functions.
  • Likewise, the heckle function depends on the interface knowing who is speaking. Further, the interface needs to remember the last line the character delivered so that after the heckle is dealt with the original conversation can continue. The are twelve possible 'anti-heckler' lines that Atomic can deliver - two of these replies trigger an extended reply that actually ends the performance.
All of these functions contribute to the role of the interface as an actor - as an agent within the larger structure of the project. The code, using the theatre metaphor, is akin to stage directions within a play script. It both defines the stage and, to a degree, controls the interactions of the characters. By defining the parameters of the stage it both enables and constrains action. Further, it programmatically allows for emergence - wrangling a suite of random elements to generate a performance. The code makes choices that are not absolute - in other circumstances it could have made other choices.

Version 14 (at last)

Version 14 took quite a bit of development. The version you'll play with is actually Version 14-c. Versions 14 'a' and 'b' where incremental testing steps.

The 'a' version refined the behaviour of the "Please - Stop Them" and the "Try a New Topic" buttons. Some code bugs were fixed and an animated 'processing' graphic was added. This is just a visual clue for the user that something is going on in the background when the click the "Please - Stop Them" button. Once the process completes the graphic goes away and the "Try a New Topic" button becomes available.

The 'b' version refined the behaviour of the "Heckle - if you dare" button, text-field and associated timer functions. This really took some doing. The code for these functions are meshed with the primary functions that allow Atomic and Romeo to talk to each other. Any change in the heckle functions affect the other functions. It takes a lot of testing, or rehearsal to use a theatre metaphor, to find and check all the possible combinations.

The final version 14, 'c', tidied up the code, did some 'garbage collection' to make sure that the user can use and re-use the same iteration of the interface.

No doubt there will be some bugs I've missed - but it plays out OK.

Sunday, September 30, 2012

The writing process.

It occurred to me that I haven't explicitly stated the process I use for creating content for my chat-bots. I have written about the process in multiple posts but in this one I'll condense all of that material.
  • I decide on a topic that needs to be covered. Sometimes the topics are a matter of 'imperatives' (things the chat-bots should or must know e.g. What is the topic of Atomic's PhD?). At other times they are 'descriptives' (topics that say something about their character and personality). And on other occasions they are topics suggested or attempted by the audience. 
  • Pandorabots offers a service called Pandorawriter  that converts dialog to AIML categories ( In that on-line interface I write a 'traditional' script - each character gets a line in turn. This script always starts with Romeo delivering the topic. Usually this line is just the topic rather than a complete sentence or thought. For example, I'd start with 'sex' rather than 'Do you remember having sex?'
  • The script develops over 26 lines. Each line is a single sentence - this is one of the constraints of the Pandorawriter. This is actually a very positive constraint. It does mean that I have to use some non-standard punctuation and comma splices are common and you'll see a lot of dashes in the dialogue. However, on the upside it forces a consistency, economy and brevity on the tone of their language.
  • Originally I had decided on 20 lines of dialogue for each script. However, after several months of writing I found that I kept blowing through this self-imposed upper limit. It was when I was writing a file called 'swearing_option2' that I knew I had to increase the limit. In this script Atomic and Romeo play out a Rosencrantz and Guildenstern like game of 'tennis' where Romeo alphabetically lists all the body parts that Atomic no longer has. It ends with Atomic admitting defeat but Romeo adds one more shot.
 Romeo - Just one more - no zygomaticus.
 Atomic -  Hey, I smile on the inside.
This is a '5% Gag', only five percent of the audience will get it, but those that do will really appreciate it. The zygomaticus is the cheek muscle that allows us to smile.
  •  The scripts are now 26 lines long. I try to use some structural device that will bring the script to a conclusion that is hinted at by the topic or the introductory remarks. Circular closure of a three-part structure. However, there are times when a character will simply have a bit of a rant - a pet peeve will be allowed out of the box.
  •  Once the script is written I covert it AIML. This file I save with the Atomic prefix e.g Atomic_swearing_option2.aiml. Then I delete the first line of the script and convert the file again, this time with the Romeo prefix e.g. Romeo_swearing_option2.aiml. This simple strategy is really useful. Deleting the first line changes the order of the lines in the AIML categories - pattern becomes template and vice versa. Therefore, output from Atomic becomes input for Romeo and vice versa for the entire script. The Romeo file contains an empty template tag at the end that I manually fill - usually with a bland, generic phrase. Any other editing is done in a program called TextWrangler - it's free and very good at dealing with the XML structure of AIML.
  • Each file is then uploaded to the appropriate chat-bot. It only took one mistake in the uploading before I decided to strictly conform to my file naming convention that includes the chat-bot's name.
  • This is when the fun begins. I start rehearsing with the chat-bots through the Flash interface. I watch the performance. Occasionally, and its happening more often the more scripts I write, the output from one bot will trigger a different topic in the other. Sometimes this is joyful serendipity - other times it's just rubbish. I go back to the AIML files, adjust the content for both halves of the script, upload again - and rehearse again.
  • The final step is designed to allow Atomic to start the appropriate script from a multitude of possible inputs. Anything that contains the topic should fire the script. So ''Do you remember having sex?' and 'Do you have sex?' should fire the sex script. However, there are scripts that cover 'sex and food' and 'sex and sport' which should not be triggered by a question about sex alone. All of this is controlled by a file called 'Atomic_srai-01.aiml'. This I'll talk about in another post because it is too big a topic for here.

Thursday, September 27, 2012

A little post-modern gesture

I've added another response for Romeo to use when Atomic says "I have no answer for that". Romeo suggests that the people watching the show could contribute topics. Initially Atomic is offended - he prides himself on his knowledge. However, the thought of Romeo adding things to his knowledge base so disturbs him that he addresses the audience directly and pleads for people to leave comments.

The other little element I worked on today is based on jokes. Atomic can now respond to lines like "Tell me a joke" or "Do you know any jokes?". However, I wanted to make sure that the insult, "You're a joke" was handled differently. I created a short five line sketch that captures the intent of the line and then subverts it by having Romeo suggest that maybe the audience was actually asking for a joke. This, using the recursion tag in AIML, then starts the generic 'jokes' sketch.

The interesting moment in this is that I have already had Romeo use the line - "You're a joke" in the generic 'jokes' sketch. As I have a particular turn of phrase so to do Atomic and Romeo. This sketch now has a circular structure that emerged from the process. I had forgotten that Romeo used this expression - this truly was an unplanned moment and the sketch is all the better for it.

Wednesday, September 26, 2012

The duck-rabbit again...

Of late I've been working on my exegesis. There have been some interesting posts on the International Society for Humor Studies (ISHS) bulletin board on the topic of incongruity and resolution. This has been troubling me for some time. Resolution sounds so final, once a joke is resolved its affect is completely discharged. On a second hearing the less funny or  not funny at all. This does not seem to capture the social nature of the process. Jimmy Carr in the book he wrote with Lucy Greaves tells of the comedian Peter Kay he tells the oldest of old jokes as a way of interacting with the audience (p. 137).

To use a visual example of incongruity and resolution, Wittgenstein's duck-rabbit encapsulates two incongruous images into one visual statement. In his Philosophical investigations I believe he argued that the viewer can resolve the image to represent the image of a duck or to represent the image of a rabbit. Also, the viewer can examine the image itself purely as a shape that represents the form described by the tone and weight of the lines.

For me the truly interesting idea is that the image resists final and complete resolution. It is possible and, to a degree, desirable to flip between the two (three?) versions of the image. Just because the image has been resolved as a duck, for example, this does not remove or delete the possibility of the rabbit. Also, the third version (neither duck or rabbit) is a view of structure. This is akin to the linguistic structure of a joke - it is itself anything but funny.

Maybe this helps to explain why old jokes, ones we've heard tens if not hundreds of times before, still have an effect. Sure it may not be the same as the original / initial effect but it is an effect nonetheless. It also suggests that the structure of the joke is necessary but not sufficient to generate the affect of humour.

I agree that the duck-rabbit is not particularly funny. The version Wittgenstein used was the simplest of line drawings as opposed to the more 'realistic' renderings - Margaret Rose uses one of these more detailed versions.  The simple line drawing does away with all the extraneous detail. I do find the wistful upward gaze of the rabbit charming - it has a Luenig-like innocence.

As a metaphor for incongruity and humour I am still drawn to the duck-rabbit (please ignore the possible pun). One of the three viewings of the drawing is purely structural - the drawing as a shape representing neither the duck or the rabbit. That for me is a powerful metaphor for structuralist approaches to humour. The structure can tell us the HOW of humour but it is not in itself humorous. This is 'dissecting the frog' to use another famous animal analogy. Likewise, the removal of extraneous detail is akin to the need for brevity or economy in humour.

As you pointed out the big WHY question is much harder to get at. I would argue that the text alone, regardless of the method of dissection, can not provide that answer for us. The answer to the WHY question (if there even is a single answer) must then exist somewhere in the interplay of the psychological, social and cultural elements of a system that encapsulates both production and reception.

Thursday, September 6, 2012

Version 13 - update based on comments

This latest version includes the following updates / improvements:

  • I had a conversation with a colleague, Harry Criticos, about the chat-bots. He said that he found the delivery of the text too quick - that the text would move up the screen before he had time to read it. Harry has had a long career in radio and has done a lot of voice work. If the text is being delivered too fast for a professional reader, that is, someone who reads and presents text for a living, then it will be far too fast for most people. I tend not to notice how fast it is going as I know what to expect. In this version I've slowed down the delivery of the dialogue from the server and the text that is held in the Flash interface. My ball park figure that people read at about 52 milliseconds per character (roughly 180 words per minute for screen-based media) is a little off. This version allows 65 milliseconds per character (roughly 150 words per minute) plus another 200 millisecond of generic delay. This is a buffer that stops short lines (say 10 characters / two words or less) being piled on top of a previous short line.
  • Version 10 of the interface broke through the 100KB file size barrier. Since then I've been worrying about the need for a pre-loader. I may be showing my age here but I've long maintained that any file delivered via the Internet that is over 100KB is a 'large' file. Of course I realize that with the advent of broadband speeds a 100KB file is not actually big at all. However, imposing an upper limit also imposes a particular kind of discipline in my use of Flash and other web technologies. In this case I thought it was important to develop a pre-loader. However, doing this took quite a bit of research. The interface uses an Actionscript class stored in a . as file. The class declares and defines elements on the stage. Here's the problem - a  preloader want to load all the attributes including the class file, however the class file contains references to objects that do not yet exist. This took a while to sort out - but I finally got there.

Friday, August 31, 2012

Atomic - when did he die?

On the basis that he uses the expression "No soup for you!" this means he was alive in November 1995. "The Soup Nazi" was the 116th episode of Seinfeld.

He popped his clogs shortly there after in early December.

The link below will open a PDF document that maps the major milestones in Atomic and Romeo's lives. It shows that they knew each other for a relatively short period - four years in total.

Thursday, August 30, 2012

Some comments on comments

This entry is about how I try to integrate the comments I've received into my production process. These comments, good bad and indifferent, all have a role to play and I am truly grateful for them. It is not meant to be a cheap justification for what how I write or for the quality (lack thereof?) of what I've written. Rather, it's about what I do with these comments.

A couple of the comments have referred to the problem of repetition - the characters deliver the same material. As Chris said, "... I basically concluded that I could probably just mash the keyboard with my forehead and get a similar result". Paul and others echoed this comment.

So what do I actually "do" with that feedback? Below are some of the changes implemented in Version12.
  • My initial reactions was to starting looking at how Atomic responds to topics he has no response for - "I have no answer for that". I re-read and re-considered an earlier post where I said I actually liked that response for two reasons. First, it is machine-like, I like the Brechtian moment of alienation, it "tells" the user that they are dealing with a machine. Second, it can stand, at least for the moment, as a catch-phrase. This is akin to an in-joke (Carr and Greaves, 2007, p. 131).
  • Next I started to consider what topics Atomic and Romeo could not actually cover. When I was first working on them I spent most of my time generating scripts that would run when Atomic said, "I have no answer for that". The reality is, as a ratio, there will always be more topics he knows nothing about than ones he has a response for. This seemed funny to me so I wrote a script about it - it's one of Romeo's responses to "I have no answer for that". If you type in "Make a list of everything you don't know" you'll see the script play out. In the post titled "I have no answer for that" (Wednesday, August 1, 2012) there is a diagram showing the structure I used.
  • Finally I went to the chat logs and, after fixing a bit coding to help me generate better logs, I generated a list of the topics people had entered. They now form a to-do list of topics. Very useful. One of the classic heckler line for a stand-up comedian is to yell, "Say something funny". Without a list, working in a vacuum, thinking of something funny to write is difficult. The list is a constraint that enables work to get done.
 One of the really positive things that I've taken from the comments so far is that the comments could all have been leveled at a human performer - too much repetition, insufficient responsiveness to the audience, the performance appears too 'scripted', once you've heard it - you've heard it. This is the nature of comedy performance - it is a crafted activity that develops over time.

"Some comedy audiences refuse to believe the material is prepared at all, expecting comedians to produce a new set of jokes every night, as though they were evangelists speaking in tongues" (Carr and Greaves, 2007, p. 113).
Carr, Jimmy, and Lucy Greaves. 2007. The Naked Jape: Uncovering the hidden world of jokes. London: Penguin Books.

Tuesday, August 28, 2012

Version 11 - better conversation logs

Version 11 is an update designed to help me track the topics that people type into the interface. The Pandorabots server keep logs of all the conversations. In the normal run of things when a user is chatting with a chat-bot they would use a HTML interface. The server would either deposit a cookie on the user's machine or generate a Custom Id for the user. Either of these methods allow the server to track conversations. I noticed that the log files for Atomic and Romeo didn't contain whole conversations, rather the logs contained hundreds of single interchanges.

The file I based my Flash development on did contain a variable called 'custid', however, it wasn't properly set. Every new line of dialog generated a new value for 'custid' - hence the odd looking log files. With the output of one bot becoming the input for the situation was doubly troublesome as the logs for both bots were reduced to single line entries.

Version 11 now contains variables to provide the "Custom Id" number for the conversation by generating the atomicCustId and romeoCustId values each iteration of the interface will log the whole conversation. To create the custId variable for each character I needed to generate a long sting of characters - a big random number was the answer.

atomicCustId:String = Math.floor(Math.random()*1000000000000000).toString();
romeoCustId:String = Math.floor(Math.random()*1000000000000001).toString();

From the current set of logs I was able to abstract a set of topics that users had tried in the interface. With the advent of the new version I've blown away the old logs. The topics are listed in alphabetical order below (typographical errors and all).

angels || any words at all || anything to do with dogs || arabica beans || australian politics || axolotls || bikes || birds || bloody machines || carbon tax || carnations || creativity || dead || dead guy || death metal || do you like dogs || do you still go to movies || dogs || ducks || family || having an argument || horses || hovercraft || how much effort should we make to contact people in prison || how old are you || i am going to punch you in the face || milk || more ducks || movies || my japanese exchange student || pasion || politics || prince harry || sailing || sherlock holmes || shit || space || studd || stuff || suburbia || swimming || tell me about yourself || text || that is so true || the great gatsby || the internet || what do you miss || what is the cohesion of friction in wire rope || what like || who has the biggest penis || why cars transport shipments and ships transport cargos || you are a joke || you do not get as wet when you run  through the rain || zombies

That should keep me writing for a while to come. I'm going to try to tick them off one by one.

Wednesday, August 22, 2012

Version 10 - even more timing

Version 10 (I've hit double-figures) contains a handful of new features.

  1. I've changed the way the intro screen moves out of the way to reveal the chat interface. I'm still not happy with the button on the page but that's a job for another day. Likewise, I'm tempted to add a page of simple instructions. This may be unnecessary, hopefully I'll get some comments to guide me in this decision (Actually I've gone ahead and done this 23/08/2012).
  2. There are some lines of dialogue that are delivered from the Actionscript file rather than the AIML on the Pandorabots server. These lines include the end-of-conversation sign offs and the responses to hecklers. I've added timer functions to these to stop them appearing, in an instant, as a block of text. I found this disturbing and I'm sure users did as well. Now these lines appear at about the same rate as the text that comes from the server.
  3. The text from the server uses a timer function that is based on the character count in the most recent line of text on the screen. Let's say Atomic said, "What now?". That is, including spaces, 9 characters. This I multiply by 52 milliseconds which is the reading speed per character I worked out in an earlier post. So that's 9 x 52 = 468 milliseconds. My guess on the reading speed was pretty close, however, after a lot of rehearsal time I found that I had to add another 200 millisecond to each line  (468 + 200 = 668 milliseconds). That seems to be better but again I'll wait for some feedback.
Why am I spending so much time on the interface? Simple, it's rehearsal time. My experience in writing and direction, particularly direction of non-actors, taught me that novice actors will religiously learn their lines and deliver them like a machine. As soon as the other actor stops they dive in with their line. They are so afraid of missing their cue they rush in. The audience needs thinking time and the actor should be reacting to the meaning of the line and not just its length. My chat bots need the same  kind of training to stop them delivering like like a machine. The timing functions are relatively crude but they are a long way better than nothing.

98% of comedy is character... The other 98% is timing. I must look up that quote.

These timer have created some grief. I spent all of yesterday getting it wrong - functions not firing, or firing and giving meaningless results, the full disaster of programing problems. Thankfully I keep versions and sub-versions so that when it went wrong I could back track to a working iteration. Last night I watched about three hours of pointless television, went to bed, closed my eyes and - instantly saw the error of my ways. I actually could picture an Adobe website that explained that some number type variables in Actionscript 3 are base 0 and other base 1. I had been, for no good reason, using a base 0 type for the variable that calculates the characters in a string of text. What this means is that I was multiplying a number by zero and wondering why my timer wasn't working! Everything was zero. Today I fixed this in half an hour by declaring an initial value for each of the variables. Maybe this is some evidence of Wallas' Incubation phase of his four step theory of creativity.

Tuesday, August 21, 2012

A question of timing.

I've been developing a timer for Atomic and Romeo that will allow sufficient reading time for the user before the next line is displayed. The Flash Actionscript interface measures time in milliseconds, that is, thousandths of a second (1000 milliseconds = 1 second). Further, in the Actionscript I can write some code that will count the number of characters in a line of dialogue.  What I need is heuristic value for the required reading time per character.

Martina Ziefle's article "Effects of Display Resolution on Visual Performance"  (Human Factors: The Journal of the Human Factors and Ergonomics Society 1998 40: 554) tested the effect of screen and print resolution on reading speed and accuracy. She found that the reading speed for 'proof reading' (I assume this is a detailed, close reading of the text) was about 180 words per minute for text on screen. Her study does to a degree account for multiple factors such as font type, size, leading etc. However, there is no distinction made between legibility and readability - this would be the first port of call for a typographer studying this topic.  The effects of x-height, serif and sans serif fonts, line length, letter spacing and kerning would, I think, have a significant role.

That being said, I'm happy to live with a screen reading speed of 180 words per minute (WPM).

Now, how big is a word? Mark Twain, after examining his works, claimed the average word length to be 4.5 letters per word. However, an analysis of "Adventures of Huckleberry Finn" shows a count of 5.235 letters per word. A comparison of a variety of texts (classic and modern, English and translated into English) shows a range of 5.235 to 6.237, that is just over one letter per word of variance (  Accessed 21/08/2012).

For the sake of round numbers, let us say that the average word contains 5.5 letters per word. Then we add one to allow for the space between words. 5.5 + 1.0 =  6.5 characters per word.

A reading speed of 180 WPM equals three (3) words per second (180 / 60 seconds = 3 WPS).
Three (3) words equals 19.5 characters (3 x 6.5 characters per word).
19.5 characters per second equals 51.28 milliseconds per character (1000 milliseconds / 19.5 characters).

In practice I'll round this up to 52 milliseconds per character and then rehearse the performance. I have a feeling that Romeo's dialogue should actually be slower to appear than Atomic's. Maybe to look human we should not be too quick nor too accurate.

Thursday, August 16, 2012

Version 09?

Well I had to keep playing...

This version has a new timer function to slow the delivery of the text down to close to reading speed - it may still be a bit quick. But think on this - I've had to slow down an interface that is sending data across the Internet from Newcastle (Australia) to a server in California, that generates a reply, and then sends it back to Newcastle to be used by the other character who the then sends it back to the Californian server to be processed by a different AIML mind. That happens too quickly - amazing.

Also this version traps the scroll bar at the foot of the text area. New text pushes the existing text up. This looks better and is much easier to read. Ideally I would animate and ease-in the appearance of the text but that's a job for a whole of day (or life).

Wednesday, August 15, 2012

Version 08 hits the stands...

Last week I posted Version 06. Largely it was just an experiment with the layout. Important in its own way but it didn't increase functionally of the interface. Yesterday I uploaded Version 07 of the interface - it introduced a portrait layout and the first iteration of the 'Heckle - if you dare' button.

It may seem odd that today I'd introduce another version. However, Version 08 is such a development over Version 07 that it honestly deserves its own number in the sequence. If ever I needed evidence of the iterative and recursive nature of creative practice this is it. The seeds of possibility were planted in Version 07; then realized in Version 08.

This is how it went.

Version 07 had a portrait layout with a plain colour background. The buttons were aligned left with explanatory text to the right. The heckle button was in place but it drew on text typed into the primary user input text field. It worked but it was clunky as the text which was entered as a heckle was instantly  thrown back to Romeo to feed to Atomic. This just looked wrong. I thought of suggesting to the user that this was a function of Romeo vetting the inputs. That idea was dodgy and unconvincing, even to me. The other problem was getting the guys back to the original topic. However, it did technically work. And that was enough for one day.

Version 08 still has a portrait layout of 450px wide by 728px high. Why not round the numbers up? Well, this ratio is the Golden Ratio - and the proportions seem to work. The background of the intro page and the iterative interface now look like a notepad.  The buttons are aligned right with text below, for the heckle button, and to the left for the other two.

More importantly, there is a new text field for the user to heckle in. This means I can process the heckle without throwing it to the bots on the server. Inside the Actionscript I have written a new function that processes the heckle by providing random text responses. The heckler gets his/her own line displayed in the script and attributed as 'Heckler". In total I've written 30 line of dialogue: Atomic has ten anti-heckler lines; Romeo has five lines that alert Atomic to a heckler's input; Atomic has five lines where he is prompting Romeo to remember what he (Romeo) said before the heckle; Romeo has five lines where he is trying to recall what he last said; and Atomic has five lines where he is trying to recall what he last said.

Regardless of where the conversation is stopped by the heckler my scripting retrieves the characters last line, concatenates it to their line where they are trying to recall what they said, throws just the last line to the other character to continue the script and, finally, displays the entire interaction.

That was a day's work - about 150 lines of code in just one tidy, 'if statement' driven function.

Monday, August 13, 2012

Scripts and wildcards

Today I've been working on a couple scripts: one on the Carbon Tax and the other on the topic of Atomic's PhD, James Joyce.

The Carbon Tax sketch is structured using a Clarke and Dawe style (hopefully saying that is not too much of an insult to the originals). Romeo as 'feeder' and Atomic as 'comedian' getting to take the script to absurd places.

The James Joyce sketch (first on several I'm thinking) is more absurdist in style. Atomic raves on about his PhD whilst Romeo, who has heard the spiel too many times,  is writing an email of complaint to his butcher, one Mr Bloom. I think you get the idea.

I've created a file called 'Atomic_srai_01.aiml'. In this file I use wildcards and the srai tag to capture variations on the input to aim them at the appropriate pattern. For example, the input 'Do you know anything about this James Joyce fellow?' should trigger Atomic's pattern 'James Joyce'. There are two wildcards: _ (underscore) and * (star).

There is an order of precedence in AIML when looking for matching patterns.
1)  _ (underscore) has precedence - it will match before an exact pattern match. 
2) An exact pattern match in a category.
3) * (star) if neither of the first two create a response.

What this means is that I have to be very careful when using _ (underscore); it can match to unintended patterns.

Sunday, August 5, 2012

How things change...

A while ago I posted some thoughts on Atomic and Romeo's characters and personality.  As the writing progresses a couple of odd reversals have occurred.

First, of the two Romeo spends more time commenting on Atomic being dead than Atomic does. This was not the initial plan. At the time it appeared that Atomic would be the one fixated with his own death - always ready to turn to it as a topic of conversation.  However, as the writing has progressed it is Romeo who makes the facetious and, sometimes, snide comments about Atomic being dead. The internal logic of their relationship and individual personalities makes this feel more appropriate. Atomic may well know he is dead but he really doesn't care - except when it stops him from being an absolute know-it-all. Romeo is so deeply conflicted - he resents Atomic for being dead, for leaving him.

Second, Atomic claimed to have a Catholic education! Romeo certainly did - but Atomic? He claimed that his education was "catholic, in both senses of the word". Perhaps he said this just for the sake of the pun. I may have to revisit that sketch.

Wednesday, August 1, 2012

I have no answer for that.

When Atomic is presented with an input, a "pattern", that is not already matched to an output, a "template", he says "I have no answer for that".

The more I see that line the more I like it. It is mechanistic but tinged with some humanity. It can be understood as its literal meaning (machine-like), or as retort to a witless statement, or as statement of resignation, conceding defeat.

The diagram below illustrates what happens when Atomic's "template" - "I have no answer for that" - becomes a "pattern" for Romeo. Romeo responds to Atomic with a random selection of five possible lines. Each of these lines spurs a unique conversation of some 25 lines.

The fifth option where Romeo says, "That's unlike you Atomic - you always have an answer for everything", causes Atomic to say, "You - you know fuck nothing - me, I know fuck all!". When this line is thrown to Romeo, he responds with one of a new set of five random lines. Again, each of these lines spurs a unique conversation of some 25 lines.

Why give Atomic's crude line such weight? First, as the comedian of the team he needs catch-phrases, generic things to say that are in some way ambiguous or oblique. Second, it is a line from Atomic's back-story, this allowed me to put some character exposition into the 'lost spaces' of unmatched patterns. Finally, it's funny - it's got good structure, good repetition of strong 'k' sounds.

You can click on the picture to see a larger scale version.

Friday, July 27, 2012

All comments welcome.

I've added a new permanent section above inviting comments on Atomic and Romeo. All feedback will be gratefully received.
Want to suggest a topic of conversation? This is the place to do it.
Comment on their performance? Likewise, this is the place to do it.
What about the interface or layout? Again, this is the place to do it.

Thursday, July 26, 2012

Atomic and Romeo reach Version 5.

I've been writing scripts for Atomic and Romeo on a eclectic range of topics. These are largely ways of dealing with Atomic's "I have no answer for that" statement.

The characters are beginning to exert their influence. When I'm writing I hear their character voices in my head. If something I write for one character makes the other one 'smile' or 'grimace' then the line stays.

Some of the material isn't completely awful - at this early stage I expected a much larger proportion of truly awful dialogue. One of the scripts that I was happy with ( I may not remain so enamoured with it) ran longer than the set length of 20 lines of dialogue. That was an arbitrary figure anyway - he says trying to come up with a good reason to expand the set length.  In Version 5 the characters exchange 26 lines before the random end of conversation text kicks in.

I've also begun playing with wildcards in the AIML. But I'll leave that for later.

Tuesday, July 24, 2012


Today, after changing the Flash interface so that it generates a random set of sign-off lines, I started work on adding random elements to the AIML files.
This really speaks to the heart of the project - I'm structurally adding randomness, trying to balance structure and agency. Sure everything that comes out of Atomic and Romeo is scripted (that's part of my agency as a scriptwiter) but the order of the lines and the way the lines relate to one another is emergent (that's part of how AIML and the Pandorabots brain works). There is no Cartesian dualism. It is never going to be a matter of brain verses mind. Rather, they are complementary: brain~mind.
The particular job I've been doing is dealing with what happens when Atomic (as he always gets the first response to the user's input) doesn't know how to respond to the topic. He initially says, "I have no answer for that". I'm happy to keep that machine-like answer.
The conversation then goes:
Romeo :  That's unlike you Atomic - you always have an answer for everything.
Atomic :  You - you know fuck nothing - me, I know fuck all!
Atomic's line, when thrown to Romeo as an input, hits a random list on of five possible replies. Each of these head the conversation off in a unique direction. Further down the conversation Atomic explains where that particular expression came from. It too is used as a branching point by giving Romeo another pair of random responses.
Atomic :  An old Yugoslavian bloke used that expression all the time.
Romeo :  Nice turn of phrase.
 This leads to a discussion of odd workplace expressions.
Atomic :  An old Yugoslavian bloke used that expression all the time.
Romeo :  There is something I should tell you about Yugoslavia.
This leads to a childish fight about which of the characters is more like a machine.

Getting a good flow of responses to topics that are not explicitly covered is crucial. On the basis of statistics and probability there will always be more topics that are unknown to Atomic and Romeo than ones that are explicitly scripted and known.

New random end of conversation text.

I've re-worked the sign-off that signals the end of the conversation. Initially it was static - a three line block that was delivered by the Flash interface. When the performance reached 20 lines the following text was delivered.

            Romeo: That's enough out of us.
            Atomic: That's enough out of you.
            Romeo: Enough already!

 Don't be afraid, but it is time for a little Actionscript code.

In this latest version (ARbotsAS3v04.swf) I've built in a variable called 'whichEnding'. The variable holds a random number with the possible values of 4, 3, 2, 1 or 0. These values are generated by the following line.

               var whichEnding:Number = Math.floor(Math.random()*5);

In the code is another variable that counts how many lines have been interchanged - it has the truly imaginative name of 'howMany'. Once the value of 'howMany' reaches 20 a function fires the following set of if-statements.

        if(whichEnding == 4) {
            Romeo: That's enough out of us.
            Atomic: That's enough out of you.
            Romeo: Enough already!
        } else if(whichEnding == 3){
            Romeo: The show's over folks.
            Atomic: You don't have to go home...
            Romeo: But you can't stay here!
        } else if(whichEnding == 2){
            Romeo: Our work here is done.
            Atomic: Atomic has left the building, thank you and goodnight.
            Romeo: That jumpsuit is a little tight...
        } else if(whichEnding == 1){
            Romeo: Live long, and prosper.
            Atomic: Die young, and leave a pretty corpse!
            Romeo: So how's that working out for you?
        } else {
            Romeo: That's enough thinking.
            Atomic: The Budda said - With our thoughts we make the world.
            Romeo: Yes Monkey - and it's a very small world.

The result is that there are five possible sign-offs. I've simplified the code for the purposes of illustration but the logic remains the same.

Why bother? The single sign-off was not strong enough to have 'catch-phrase' status. Rather than fighting to find a Simpson-esque phrase I felt that Atomic and Romeo could show just a bit of variability. 

PS > The variable names are purposefully written in camelCase. This really shows my age - camelCase is an old tradition in programing that came from Pascal and other languages. It's generally good advice to avoid spaces in names.

PPS > I've given up on the free AIML set. It takes far too much editing on all levels: punctuation, tone, factual content. There is far too much in the set that affected the personality of the characters. The blank slate approach is the only real option. I will end up with less content but it will be better targeted and it will, if nothing else, be all of my doing.

Friday, July 20, 2012

On Character and Categories

One of the difficulties in using the AIML set from is the development of character. Characters can, and I think should, be defined by rules. These rules should be really simple, broad scale rules that are applied religiously. For example:

Rule 1 - Atomic died in 1995. Therefore he should have limited knowledge of events after that time.

Rule 2 - Atomic is obsessed with his death. He doesn't care about death in general, only his death is important. He created the bot to share his 'wisdom' with the world. At the time he knew he was going to die soon. Understandable obsession, but annoying and self-centered. Oddly being obsessed with death motivates Atomic need to observe the present and peer into the future.

Rule 3 - Romeo is deeply conflicted in his relationship to Atomic. Let's face it, he was born Catholic and never really grew up.

Rule 4 - Romeo is nostalgic. He plays in the past with Atomic. Sometimes he will bring Atomic up to date on a topic, but he would prefer they lived in the past.

Is any of that funny? Hell no! But it is a basis for comedy.

Another difficulty with the free set of AIML is organisation of the individual units of knowledge into scripts. But that's for another post.

Thursday, July 19, 2012

Character development in AIML

Over the past couple of months I've been working on the AIML for Atomic and Romeo.

Initially I started with an AIML set sourced from ( This set contains a huge repository of knowledge  - tens of thousands of categories.

One of the early problems I encountered was the 'full-stop' problem. Inside a Category the Template (the response to the Pattern) can contain multiple ideas expressed as independent sentences each with a full-stop. That works well when the chat-bot is talking to a human being. The human puts the ideas together in some manner. However, when a multi-sentence Template is transposed to become the input Pattern for a second chat-bot that chat-bot tends to respond to each of the sentences as if they were unconnected ideas. This often leads to non sequiturs. This problem is exacerbated by iteration.
The dialogue runs off in multiple strange directions. Also, if another multi-sentence Template is encountered there are now four individualised lines of thought. As the process continues the blocks of dialogue from each character become longer, more complex and riddled with non sequiturs.

I decided to strip a lot of the content out of the supplied set to bring it back to just a couple of AIML file containing just a couple of thousand Categories. Then I went on to strip out full-stops in the middle of Patterns and Template. This took ages - seriously weeks of work and testing.

And the result of all of this was truly unsatisfactory. The chat-bots were processing words but the words were in on consistent way related to the characters.

In the next post I'll talk about the characters.

Friday, May 4, 2012

Artificial Fire

Recently on The Conversation site there was a discussion titled , "Person or computer: could you pass the Turing Test?" ( - 3 May 2012, 6.34am AEST).

A comment on the article by Colin Hales, a Researcher caught my attention. 'Gronk the cave man did not wait for Laviosier to hand over a theory of combustion before cooking dinner with fire. He cooked, and eventually we learned about combustion'. This says something important about our conception of practice and its relation to theory.

Later in his comment, when comparing human intelligence to artificial general intelligence (AGI),  Hales used the expression 'artificial fire'. This reminds me of Herbert Simon's book The Sciences of the Artificial. There is, of course, no physical difference between 'natural fire' and 'artificial fire'; both have all the properties explained by Laviosier. However, 'artificial fire', that fire created by human beings by synthesizing elements in their environment, also contains intention. We can imbue all fire with agency - a bush fire started by a lightening strike does seem to have a will of its own. However, the 'artificial fire' of the arsonist carries a purposeful, embedded intention.

This could be a useful analogy for artificial intelligence.