summaryrefslogtreecommitdiff
blob: e60f8a0e5753ea1a3ad10b8dcf4dbabca04f1244 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# zero-of-one
(Yet another) Markov chain based IRC reply bot.

## Dependencies
- POSIX compliant OS.
- C compiler (with C99 support).
- CMake.

## Quick setup guide
```
$ git clone https://github.com/nsensfel/zero-of-one.git
$ cd zero-of-one
$ mkdir build
$ cd build
$ cmake ..
$ make
$ ./zero_of_one -h
Usage: ./zero_of_one [option_1 option_2 ...] NICKNAME [ALIAS_1 ALIAS_2 ...]
NICKNAME is used as the IRC nickname value.
If NICKNAME or any ALIAS is found in an event, the program will reply.

Available options:
   [--data-filename | -df] FILENAME
      Learn content from FILENAME before connecting.
      Default: ./memory.txt.
   [--new-data-filename | -ndf] FILENAME
      Store new data learned in FILENAME.
      Default: value of the --data-filename param.
   [--irc-server-addr | -isa] IRC_SERVER_ADDR
      Connect to this server address.
      Default: irc.foonetic.net.
   [--irc-server-port | -isp] IRC_SERVER_PORT
      Connect to this server port.
      Default: 6667.
   [--irc-server-channel | -isc] IRC_SERVER_CHANNEL
      Connect to this server's channel.
      Default: #theborghivemind.
   [--irc-username | -iu] USERNAME
      Connect using this as 'username' (shown in WHOIS).
      Default: zeroofone.
   [--irc-realname | -ir] REALNAME
      Connect using this as 'realname' (shown in WHOIS).
      Default: Zero of One (bot).
   [--reply-rate | -rr] REPLY_RATE
      Chance to reply to an event (integer, range [0, 100]).
      Default: 8.
```
Note that if the NICKNAME has a uppercase character, it will never be matched by
any inputs, as all inputs are converted to lowercase. A simple solution is to
have a lowercase version of NICKNAME in the ALIAS list.

## Main Objectives
- POSIX compliance.
- Paranoia levels of error checking.
- Low RAM usage.
- Giggles.

## Behavior
- Replies when it reads messages containing a word matching its NICKNAME or one
   of its ALIASes.
- Replies to messages with a REPLY_RATE percent chance. The word used to
   construct the reply is the less known one.
- Reacts to user joining in. If the username is in enough samples, it is used
   to construct the greeting, otherwise a random word is selected as starting
   point.
- Repetition is taken into account and augments the strength of the links.
- Some punctuation symbols are identified (e.g. "example." will be understood
   as "example" followed by ".").