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..."


In reply to Dueling Alicebots by patgas

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.