I threw this together to watch two Alicebots (http://www.alicebot.org/) have a discussion. I'm sure everyone's seen the same thing with chattering Elizas... Alice does provide a few entertaining quips once in a while, but it does have a tendency to get stuck in loops a lot.
ALICE 0: What made it so obvious?
ALICE 1: It's all part of God's mysterious plans.
ALICE 0: Which part?
ALICE 1: The large one, I think.
#/usr/bin/perl -w
use strict;
use LWP::Simple;
use URI::Escape;
use URI::URL;
my $currentAlice = 0;
my @bots = ( int( rand 999999 ) + 1, int( rand 999999 ) + 1 );
print "Enter starting text for ALICE $currentAlice: ";
chomp( my $text = <STDIN> );
while (1) {
print "ALICE $currentAlice: $text\n";
my $url = URI::URL->new( "http://alicebot.org/a.l.i.c.e./CHAT" );
$url->query_form(
text => uri_escape( $text ),
virtual => "alice$bots[$currentAlice]",
submit => 'reply'
);
my $source = get( $url );
next unless $source;
$source =~ m,<font face=\"Helvetica\" color=black size=\+1>(.*?)<b
+r></font></b>,s;
$text = $1;
$text =~ s/<[^>]*>//g;
$text =~ s/\s+/ /sg;
$currentAlice ^= 1;
sleep( 1 );
}
Update: The URL I was using stopped working for some reason, and alicebot.org's version now uses a different URL altogether, so I changed it. It also goes a lot faster than before, so I put in a sleep.
"We're experiencing some Godzilla-related turbulence..."