Optimizing action combiner (for IRC bots)

0. Contents

   1. Purpose
   2. Examples
      2.1. Distributing and combining mode commands:
      2.2. Combining without agents
   3. Copying
   4. Requirements
   5. Downloading

1. Purpose

modecombiner is a generic three-input logical expression optimizer, designed to distribute IRC operative actions to agents on various channels.
It takes a list of agents, list of channels each agent is on, list of actions and list of channels each action affects.
It produces a list of operations for each agent, to submit the wanted operations. It tries to produce the smallest list of operations to do the job, utilizing the necessary number of agents.
It also takes the priorities for each agent, and picks the ones who are most eager to do the job.
 
IRC Action combiner v1.5.4 for agent system like in BisqBot
Copyright (C) 1992,2002 Bisqwit (http://iki.fi/bisqwit/)
No warranty whatsoever. Distributed under the terms of GPL v2, see COPYING

Usage: modecombiner [--notest] <agentdef> [<...>] /<op> [<opdef> [<...>]]

	--notest disables combining parameter limits.
	agentdef is: <nick>[:<load>[:<reliability>[:<hostload>]]] <channellist>
	channellist is: "<chan> [<...>]"
	For op='M', opdef is: <modestring>
	For op='K', opdef is: <kickstring>
	For op='T', opdef is: <topicstring>
	For op='G', opdef is: <msgstring>
	For op='N', opdef is: <noticestring>
	For op='Q', opdef is: <whoisstring>
	For op='O', opdef is: <functionstring>
	modestring is: "<chans> <modes> [<parameter> [<...>]]"
	kickstring is: "<chans> <nicks> <text>"
	topicstring, msgstring and noticestring are: "<chans> <text>"
	whoisstring is: "<nicks>"
	functionstring is: "<chan> <function> [<parameters> [<...>]]"
	chans is: <chan>[,<chan>[<...>]]
	nicks is: <nick>[,<nick>[<...>]]
	modes is a combination of alphabets and +/- signs.
	load is an unsigned integer, describing the load the agent has.
	reliability is an unsigned integer, bigger value meaning more reliable.
	hostload is an unsigned integer, used in functionstring; means host load.
		reliability value is used if two agents have equal chance otherwise.
Output consists of lines of following format:
	<op> <nick> <command>
	op=W is a special case: it means there is no agent
	able to do the job for the particular channel.
	op=O is handled specially (no grouping happens).

2. Examples

2.1. Distributing and combining mode commands:

Running:
  modecombiner \
    Agent1 '#c2' \
    Agent2 '#c1 #c3 #c2' \
    Agent3 '#c3' \
    /M \
    '#c1 +o bisqwit' \
    '#c2 +mnsto bisqwit' \
    '#c3 +ooo bisqwit bisqbot Agent2' \
    '#c3,#c1 +v Mog' \
    '#c4 +o bisqwit' 
Result:
  W #c4 M +o bisqwit
  M Agent1 #c2 +omnst bisqwit
  M Agent2 #c1,#c3 +ov bisqwit Mog
  M Agent3 #c3 +ooo bisqwit bisqbot Agent1

2.2. Combining without agents

If you just want to combine actions but don't have a list of agents to do it, specify one agent that is on all the channels.
 
For example, with this task list (file tasklist.txt):
M #Huffi +o Guffi
M #Frumble +o nngh
M #Frumble +o Zonk
M #fozz +o nngh
M #fozz +o Zonk
M #Muffi +o Guffi
M #fiuu +o nngh
M #fiuu +o Zonk
M #sc2.ja +o nngh
M #sc2.ja +o Zonk
and this shell command:
fn=tasklist.txt
chanlist="$(echo `sed 's/^..//;s/ .*//' <$fn |sort|uniq`)"
sed s/^..// <"$fn"|tr '\n' '\0'|xargs -0 modecombiner --notest _ "$chanlist" /M
You get this task list:
_ M #Huffi,#Muffi +o Guffi
_ M #Frumble,#fozz,#fiuu,#sc2.ja +oo nngh Zonk
Okay, this might not look as simple as it is, but the result is nice, isn't it?
The --notest is there to allow grouping more than three parameters for modes.

3. Copying

modecombiner has been written by Joel Yliluoma, a.k.a. Bisqwit,
and is distributed under the terms of the General Public License (GPL).

4. Requirements

GNU make is probably required.
A C++ compiler with a decent support of templates and virtual classes is required too.

5. Downloading

The official home page of modecombiner is at http://oktober.stc.cx/source/modecombiner.html .
Check there for new versions.

Generated from progdesc.php (last updated: Tue, 14 May 2002 17:37:37 +0300)
with docmaker.php (last updated: Tue, 14 May 2002 17:30:47 +0300)
at Tue, 14 May 2002 17:37:37 +0300