Page 1 of 1

Combinatorial logic

Posted: Mon Aug 20, 2012 5:42 pm
by terkio
I found no clean way to make a set of levers open a door when they are all in a given position. I do not want a one shot operation, I want the door state to depend only of the levers position.
I found a solution that will be slow when using many levers.
I found a solution that will be fast when using many levers, but it crashes RTC when a player twiddles a lever too quickly.
I don't see an easy solution that will be fast and crash safe.
How come it is so hard to do combinatorial logic with RTC ?
Am I missing something ?
Is there a solution with relays ? I see boolean fonctions in the relay....AND OR XOR and so on.
Please help me, about the relay. The wiki did not help, telling no more than I can read editing a relay.


I found some answer.
With a counter I can make an AND over several levers. Each lever doing a toggle to the counter.
With a counter I can make an AND over several floor triggers. Each trigger doing a activate, constant weight to the counter.

Re: Combinatorial logic

Posted: Mon Aug 20, 2012 6:46 pm
by Gambit37
I stopped using RTC, so I'm sorry that I can't really help.

I'm not sure that there's anyone left on the forum who is still doing complex stuff in RTC, but if there are, then I think that would be Parallax, the_master or Joramun.

Re: Combinatorial logic

Posted: Tue Aug 21, 2012 12:13 am
by Paul Stevens
Using counters to perform combinatorial
logic is like using a drill press to cut a board
in half. The tool does not match the task.

I have never used RTC. But....
You want to use relays, if they have AND
functions.

switch1 AND switch2 AND (NOT switch3) AND ...

So you need a NAND function or a NOT function.
A NOT can be created with XOR if needed.

Re: Combinatorial logic

Posted: Tue Aug 21, 2012 2:01 am
by terkio
I agree from a theoretical point of view.
However, I only find work arounds with RTC.

I did not beleive a counter was a way to go. Amazingly it works nicely.
With a counter I can implement: pad1 AND pad2 AND (NOT pad3) AND ... Where pads are loaded or not loaded.

The trouble with the relay is: I can't figure out how to use its operator and I don't find an example.

Re: Combinatorial logic

Posted: Tue Aug 21, 2012 8:07 am
by beowuuf
Basic DM had a four input AND gate that you could configure, and counters were seperate, RTC intentionally used counters and relays as the simple building blocks for complex puzzles.

Relays used to be simply that - it took a signal in, and propigated (but could also change its state along the way). It then had added comparative functionality, so you can compare the input and look for it being related to a certain output - a certain champion created the state, a certain item, etc.

For what you want to do, counters and relays (without the complex boolean stuff) should work. If it's not working with the levers, it's because there's some quirk of the lever that's making it work strangely because of the on/off nature of the lever. Try using different input signals with the counter system that works.

Re: Combinatorial logic

Posted: Tue Aug 21, 2012 5:55 pm
by Paul Stevens
I gather that an RTC counter is more than just a
counter. It must be more like an ALU (Arithmetic
Logical Unit) in a CPU.

Re: Combinatorial logic

Posted: Tue Aug 21, 2012 7:25 pm
by beowuuf
The counter in RTC is basically like the counter in DM, except re-useable (it does not disable itself at 0). Using wall_action objects you can set a counter's value . And relays have a secondary comparative ability that can read a value on a counter.

Re: Combinatorial logic

Posted: Sat Mar 16, 2013 11:16 am
by Lord_BoNes
Where counters are concerned, ACTIVATING the counter makes its value decrease by 1, DEACTIVATING the counter makes it increment by 1. This might seem a bit backwards, but it works this way for a reason (most probably for the puzzles in the original DM games).

To work with a bunch of levers and such, you can just have each lever with ITS OWN COUNTER that you toggle with said lever. Whenever a lever changes state, just use a series of relays to check the value of each counter... if they're all what they should be, then trigger the effect (open a door or whatever)... and if they're not what they should be, then deactivate the effect (close the door again).