The And/Or Actuator
This actuator type is very handy for performing the logical operations of 'AND" and 'OR'. Examples of use:

- Hold a door open if two switches have been pressed. In other words, if the first switch has been pressed AND if the second switch has been pressed.
- Hold a door closed if either of two switches has not been pressed. In other words, if the first switch has not been pressed OR if the second switch has not been pressed.
- Close a pit if all four Knights have been released from their prison cells. In other words, if the first Knight has been released AND the second Knight has been released AND the third AND the forth.
- Close a pit if a Worm Round is in an Alcove OR the party possesses a Dexhelm.
- You can make up dozens more......this is one of the most common logic functions used in the dungeon.

A little thought will reveal that the first two of these examples are IDENTICAL in function. These examples are included to demonstrate that the functions of AND and OR are equivalent. You just have to reverse the inputs and outputs. In this case the inputs are 'Switch pressed' (reverse is 'Switch not pressed') and the output is 'Door open' (reverse is 'Door closed'). Therefore, you can think of this actuator as performing either an 'AND' function or an 'OR' function. This equiavalence is known as DeMorgan's theorm.
I will talk of this gate as an AND gate for simplicity. It has a four-bit 'memory'. Each bit can be 'set' to 'True' or 'Cleared' to 'False'. The values are initialized when the dungeon is designed and then are changed by sending Timer messages to the cell containing the Actuator. Timer messages are directed to a cell address and a position within that cell. An And/Or gate is located at a particular position within the cell. BUT!!! In the case of an AND/Or gate, the position information is not used to locate the gate. When a Timer message arrives at a cell, it is received by ALL And/Or gates in that cell, reguardless of position. The position information in the Timer message is used, instead, to determine which of the four bits in the gate's memory will be Set (to True) or Cleared (to False).
OK. Now we have four bits of memory that can be independently initialized when the dungeon is designed and that can be independently Set or Cleared during gameplay by Timer messages. Now we will add the 'Target' values. These are four bits that are specified at design time and which cannot be changed during gameplay. So let us name the 'Memory' bits M0, M1, M2, and M3. And let us name the 'Target' bits T0, T1, T2, and T3. The And/Or actuator tests whether (M0 equals T0) AND (M1 equals T1) AND (M2 equals T2) AND (M3 equals T3). Hence the 'AND' part of its name.
That is the basic operation of the 'And/Or' Actuator. The test for equivalence of the four memory bits and the four target bits. But there are some added features that make the Actuator more versatile.
Let us talk of the Actuator as an ordinary light switch; like the one on the kitchen wall that controls the ceiling lamp. The kitchen light is on when the switch is in the 'Up' position. We will pretend that the Actuator contains an internal light switch. Here is how it works:

- When a Timer message arrives the appropriate 'Memory' bit is Set or Cleared or Toggled according to the function specified in the message.
- The (imaginary) light switch is placed in the upper position if all four 'Memory' bits are equal to their corresponding 'Target' bits.
- If the 'normally-closed' mode is specified then the switch position is reversed. This is what allows the 'Or' operation.
- If 'Input Edge Detection' was specified and no 'Memory' bit was changed then quit....do nothing.
- If 'Output Edge Detection' was specified and the switch position is the same as it was before the Timer message arrived then quit....do nothing.

Now it has been decided that we should send a Timer message of some sort. The designer specified what sort of message to send. There are four possibilities:

1. Set. If the switch is 'Up' send a 'Set' Timer message. If the switch is 'Down' quit...do nothing.
2. Clear. If the switch is 'Up' send a 'Clear' Timer message. If the switch is 'Down' quit...do nothing.
3. Toggle. If the switch is 'Up' send a 'Toggle' Timer message. If the switch is 'Down' quit...do nothing.
4. Hold. If the switch is 'Up' send a 'Set' Timer message. If the switch is 'Down' send a 'Clear' Timer message.

That is all there is to it. Except that actually sending the message is accomplished by the function 'QueueSwitchAction'. That function may disable this Actuator or perform some action other than sending a Timer message.
In the DM/CSB editor 'CSBuild' most of these details are hidden and the operation is specified in a bit more intuitive way.