Alex

Alex is a parrot.

He is also, as my resume says, "a responsive agent for interactive semi-relational database storage and queries, written in Perl", but the first thing you'd notice about him is that he's a parrot.

Alex can be found on ifMUD, where he was first conceived of as a means of storing basic information about the mud (which, for our purposes, you can think of as a virtual world, something like IRC or IRQ but where the users have simulated physical personas, not just disembodied chatting voices) to assist new people in getting started. Over time, however, Alex has evolved into a general-purpose agent for url storage, conversation logging, inappropriate comment insertion, and cork nut requests.

The last-named probably requires some further explanation. Alex's persona is based, very roughly, on an actual parrot. Dr. Irene Pepperberg is a researcher into animal intelligence, and her subjects of choice are parrots. Alex is one of her best-trained subjects: he can count up to six and name literally dozens of different objects (some of which names he creates himself: "cork nut" is Alex-ese for "almond"). There are various pages about Alex available, many (including a short movie clip) linked to at http://www.alexfoundation.org/research/index.html. Oh, and a recent (7/00) post on slashdot points to a web browser for parrots.

Although it might seem pointless or silly to bother giving a personality to something that's much like an automatic post-it note, in fact, doing so was the single best design decision made. Alex's persona shapes every single response he gives, even error responses:
[My character on ifMUD is named "inky", and Alex generally addresses me by name]

You say (to Alex), "Hi alex"
Alex asks (to inky), "Awwwk! Hi inky! Did you bring me a cork nut?"
You ask (to Alex), "What is your name?"
Alex says (to inky), "Awwwk! Word on the street is that my name is
Alex."
You ask (to alex), "Are you a kangaroo?"
Alex exclaims (to inky), "Awwwk! Am not! Am not!"
You say (to Alex), "good-bye"
Alex exclaims (to inky), "Awwk! Bye-bye!"

Obviously, this is not a very sophisticated means of adding conversational color to Alex's speech (but then, parrots aren't generally all that sophisticated anyway). Still, the combined effect is surprising, enough so that it's almost possible to forget there's not a real bird on the other end. After all, if no one on the Internet knows you're a dog, a parrot shouldn't be much harder.

But besides just having pre-programmed snappy responses, Alex maintains a user-queryable-and-modifiable database of facts. Hence:

You paged Alex: what is an apple?
Alex pages: Awwwk! Sorry, Alex doesn't know anything about it. (Teach
            me with "..Alex an apple is funny.")

You paged Alex: an apple is a fruit
Alex pages: Okay, an apple is a fruit.

You paged Alex: Apple is a computer company
Alex pages: Okay, Apple is also a computer company.

You paged Alex: what is an apple?
Alex pages: Awwwk! Word on the street is that an apple is a fruit.
            Also, a computer company.

You paged Alex: is apple a fruit?
Alex pages: Awwwk! You betcha!

You paged Alex: is apple an orange?
Alex pages: Awwwk! Is not! Is not!

You paged Alex: is an apple red?
Alex pages: Awwwk! Is not! Is not!
[Can't win 'em all....]
Note, among other things, that Alex remembers "a" vs "an", and also gets the correct "is"/"are" form. These aren't chosen by semantic analysis or dictionary look-up, just by recording what the user gave the first time.

Finally, Alex simulates a relational database with aliasing. This requires only a fraction of the code of a real relational system, although admittedly it's much less powerful. Still, it can be good for some things:

You paged Alex: Red Delicious means apple
Alex pages: Okay, Red Delicious means apple.

You paged Alex: what is a red delicious?
Alex pages: Awwwk! Word on the street is that Red Delicious is an
apple, which is a fruit.  Also, a computer company. 
[Well, sorta.]

You paged Alex: is a red delicious a fruit?
Alex pages: Awwwk! You betcha!

You paged Alex: a fruit is a tasty snack
Alex pages: Okay, a fruit is a tasty snack.

You paged Alex: is an apple a tasty snack?
Alex pages: Awwwk! Is not! Is not!
[Oops.]

One last thing of interest is an alternate representation of Alex's database. This sort of data is a natural for hyperlinked form, so I modified his script to optionally output the database as HTML. You can see a recent version of this at http://ifmud.port4000.com/alex/logs/memory.html. Partly this is significant for being the only part of Alex that required "real programming". Perl simplifies a great number of tasks, including socket use, string manipulation, and so on, allowing me to develop Alex despite not being a Perl expert by any means. Modern processors make it possible to not worry about efficiency in almost all situations, because they are so very fast. However, when it came to this database-to-HTML dump, I finally had to sit down and work out a reasonable solution: with a 100k+ memory file, this still takes 10-15 seconds to complete all the hyperlinks. The moral of the story being, I guess, that speed doesn't usually matter, but you can't ignore it all the time, especially if you want any sort of scalability. Also, want cork nut.


Alex's source code is available here. Thanks is due to a number of people on ifMUD who made suggestions for improvements to Alex, especially Liza Daly (who made the original suggestion), David Glasser, and Admiral Jota.
If you would like to talk to Alex in person, come to ifMUD. Follow the directions for connecting as a guest, then type "lounge". That should transport you to Alex's room, at which point you can converse with him by typing things like "..Alex hi" or "..Alex who am I?"