feloneouscat
Wobbly Logic
by
, 05-01-2009 at 05:09 PM (9484 Views)
Some folks have been intrigued by my last blog using pistons for logic, but would rather use wobble bolts.
At first I dismissed the thought - after all I've been using pistons since day one, why change my habits now? But like any good engineer, I can't help but dabble in things that I probably shouldn't.
We won't go into my failed attempts to revive a dead relative (didn't go quite... as planned) - but let's skip that little item and move on.
A Way of doing Wobble Logic
Let's start off with the basis of all logic, the lowly OR gate. I'm assuming that folks have gone through the basic logic levels - there are at last count, about a billion of them - so, I won't bore you with the details.
If you WANT details, then go to the logic levels - frankly they show you how simple digital logic really is.
Later in this series I will go into the more horrible... er... FINER aspects of logic design.
But First, the OR Gate
Let's take this example as our OR gate:
The "propeller in a circle" like objects are wobble bolts set for 90 degrees. They are on a blue circle (I like blue glass) and bolted to a block of my favorite, red glass.
Notice that there is a bubble on the bottom wobble bolt - that means that it turns backwards. This is important to get it going the right direction.
Both switches are set to "<-/->" and the output of the magnetic key switch is set to "<-/->" for later logic.
Now if we flip either one of the switches we get a corresponding output:
The above image has both switches turned on, but trust me, it works like your standard OR gate. Build it yourself if you want to see it work!
Logic of Equivalent Exchange... Redux
Remember in my previous blog where I said all you had to do was invert the input and output and you get an AND gate out of an OR gate?
Well, it turns out this logic still holds (I was on pins and needles there for a moment).
To create an AND gate we reverse the motors and invert the output.
This is sooooo, easy, even I can do it!
To get this to work correctly we have to do three things:
- Make the top motor move backwards
- Make the bottom motor move forwards (i.e. NOT backwards)
- Invert the output of the magnetic key switch
If you forget to change the motors you end up with what is called a NAND gate (also a very useful device). However, we won't go into its uses today.
Okay, So Why Should I Care?
As an engineer, and yes, if you are building levels in LBP you are now an engineer, it always pays to have some tricks in your back pocket. You may not need it today, Maybe not even next week, but at some point you will go "darn, how do I do this and that with something other than a piston?"
I Like It. But Aren't there Too Many Parts?
Yes. Looking at this we can easily simplify it and turn it into an AND gate using ONE magnetic key and ONE magnetic switch with the following:
Wicked! That's approaching the simplicity of a piston AND gate. And without the annoying breakage.
But can we turn this into an OR gate? Yes. Logic is logic and it doesn't discriminate between pistons, wobble bolts or emitters (yep, you've seen emitters as logic devices). In fact it would follow the same rules as before:
- Make the top motor backwards
- Make the bottom motor forwards (i.e. NOT backwards)
- Invert the output of the key switch
And it would look a lot like this:
Are our brains about to explode? If they do it would be really messy and my mop, well, I broke it. I do that sort of thing.
I Dare You to Make an XOR Gate
I have to admit that this had me stumped for a few minutes. Then I recalled how it was done with pistons and you know what? It turns out to be trivial. In fact, the parts count is exactly the same!
Note the the wobble bolts are set to turn at 180 degrees instead of 90 degrees. This design also takes good advantage of Media Molecules free update to the sensors.
All in all this is a nice, elegant design.
How about More Than Two Inputs?
Who am I? Your go-to guy? Okay, I'll go to this drawing:
As indicated previously, it takes very little other than inverting the magnetic switch and changing the direction of the wobble bolts to turn this homely OR gate into a wickedly rugged AND gate...
Do you Have A Level That I can Copy?
Yup. Just search for @feloneouscat and it is one of the levels with a Tiger's Head. It is named logic blog - yes, rather boring isn't it?
Hasn't this Been Covered in Logic Levels
Yes. However, I want to go more in depth.
My next article will go into more depth with something useful. If you have something that you would like to see, feel free to leave a note or PM me.
Not everyone is a logic wizard - they would like to be able to use something a little more complex than AND's and OR's, but for them it just doesn't work.
What I want to show folks is there are steps you can do that actually make this process easier.