Hobbes
Hobbes is an IRC bot written in C which learns to talk by listening to what other users say in the IRC channels.
WARNING: I can not guarantee that this program is free for bugs and thus it could make your system vulnerable to attacks! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
How it works
At first run, Hobbes is completely dumb. He does not know any words and hence is unable to speak. After listening quietly in one or several channels, he grabs what people say and stores it in a database of words. After some time of learning, Hobbes will be able to speak in the channel based on what he has learned. What should trigger a reply can be many things. It can for example be when someone mentions his name or when a word appears that occurs more than N times in the word database. In either case, Hobbes could say something starting at a completely random word, or he could try to say something based on what input he has received from the trigger.
My implementation only supports random start words and sentences are only triggered by the name of the bot being mentioned.
Learning
Hobbes stores every word he sees in a word database (a binary tree for example). Each word points to another word, or EOS (End Of Sentence). When Hobbes hits an EOS, the sentence is finished and he writes it into the channel.
For example:
Hobbes gets the following sentence:
Hi, how are you?
First, he stores the first word "Hi,". Then he puts this word in a list of words that are allowed to start a sentence. Then he goes on to the next word "how". He stores this word and makes a new pointer from the previous word "Hi," to this word "how". Then this process repeats until he gets to the last word "you?", which he finds out is the last word in the sentence and makes a pointer from it to EOS.
Then, Hobbes gets another sentence:
I am fine, how about you?
The same process is repeated, and if any words already exists, a new pointer is added to the existing word. These two sentences would generate the following word graph:

With this database of words, the following valid sentences can be generated:
Hi, how are you?
Hi, how about you?
I am fine, how about you?
I am fine, how are you?
Installation
Extract the files from the archive with:
tar jxvf hobbes.tar.bz2
Then navigate to the src directory:
cd hobbes/src/
Then type make to compile hobbes:
make
Two executables will be created: hobbes and hobbes_p2p. The latter is a non-IRC version of Hobbes which connects directly to a raw server and waits for input.
Usage
To run Hobbes, run
./hobbes [options]
For a list of options, see ./hobbes --help.
Typically you want to specify the server, nickname, owner and channel to join:
./hobbes -s irc.example.com -n hobbes -o your_nick -c \#your_channel
Don't let it run for that long though (>10hrs), as it will eat up your memory once its word list gets larger. Especially if you put it in a channel with a lot of activity.





