Free

Our Site Admins are: Silent_x_L3gend, UberOrbPS and Zeusintraining
©️ Copyright Littlebigpod 2011
Latest topics
» Our new moderator
Fri Oct 07, 2011 4:24 am by Silent_x_L3gend

» I AM PUNCHING YOUR SALAD!!
Thu Sep 22, 2011 6:05 am by Silent_x_L3gend

» Sticker Panel Animation (The easiest way)
Tue Sep 20, 2011 8:01 am by butaneflame

» New here! :)
Mon Sep 12, 2011 6:58 am by Silent_x_L3gend

» Hide n Seek
Sun Sep 11, 2011 11:51 pm by Silent_x_L3gend

» Speed Sensor -quick speed trap tutorial example
Sun Sep 11, 2011 2:45 pm by butaneflame

» LittleBigPod Picks (Official Site Level Showcase)
Tue Sep 06, 2011 8:47 am by butaneflame

» Pod Picks 3
Mon Sep 05, 2011 8:59 am by Silent_x_L3gend

» Site Feedback
Mon Aug 29, 2011 9:00 am by butaneflame

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Search
 
 

Display results as :
 


Rechercher Advanced Search


You are not connected. Please login or register

How to Binary logic: The new face behind a good LBP2 level

View previous topic View next topic Go down  Message [Page 1 of 1]

butaneflame

avatar
Tutorialist
Tutorialist
The most useful logic you'll be using in LBP2 are simplied below.



AND = All inputs must be active for it to activate.

OR = One or all inputs Must be active for it to activate.

XOR = Only activates if one input is active and not if more than one or none are active.

NOT = Gates are backwards, for instance:

NAND = Activates when none or one input is active.

NOR = Activates when no inputs are active.

XNOR = Activates when no or at least more than one inputs are active.

(NOT has many many uses depending on the situation, fo instance, when you have a cable connected to various objects and want one to be reversed of how the other one is, instead of having to make a whole new system, you can just attatch one of the wires to a NOT gate and it'll all work. )



- Microchips can and should be named.

- Inputs and outputs can be named.

- Wires can be re-stablished and re-organised by setting them on nothing 1st then connecting the new input that was just made to the switch/ gate, these inputs can also be named as well.



Adding a link that may prove to be very useful for others.



http://en.wikipedia.org/wiki/Logic_gate



Folow this link for real world applications of logic



http://www.play-hookey.com/digital/basic_gates.html





Ok so lot's of people are having problems with logic, and I can understand its a bit of a benign concept that can be hard to wrap your head around.



Ok so first off, whats a boolean, or binary? Simply put, it stands for dual values. Everything in boolean logic has one of two values, on, or off. Represented by 0 or 1.



Now when it comes to lbp sometimes your boolean values can be special, instead of on/off they get transformed into left/right, IE winches and etc.



Now logic gates are special switches that take in a bunch of inputs, and pump out an output based on the inputs. If you recall highschool math this is called a function, turning multiple inputs into one output. Think of it like a machine you feed a bunch of things into and it pumps out a single answer.



There are a few primary logic gates in LBP. OR, AND, and XOR. Also there is NOT but thats kind of not the same as it only ever has one input.



First off is the simplest gate, NOT. Not flops the input into it. If you input 1, it outputs 0, and vise versa. The best representation of a logic gate is via something called a Truth Table. This is a representation of all possible inputs and their outputs.



For example, here's the truth table for NOT



IN OUT

0 1

1 0



Often for logic functions/gates, the inputs are represented by variables, generally p, q, r, and s. Others are a, b, c, and d. etc etc it doesn't matter. The ones to avoid are v, o, l, x, and i. Simply put, these letters can be mistaken for variables/symbols used in logic.



Next up is the AND gate. This gate is pretty simple. Our LBP2 AND gates take in a lot of possible inputs, with a minimum of 2. The AND gate only ever outputs true when every single input is one. If even one is off it will output 0, off.



Lets make the simple truth table for AND with 2 inputs.



s q OUT

0 0 0

0 1 0

1 0 0

1 1 1



Next up is OR, this is basically a connector for lines. It lets you combine multiple inputs together to control one thing, but has other uses as well. Essentially if even just one input is one, or even all of them, it outputs true. The only time it outputs false is when every single output is off.



s q OUT

0 0 0

0 1 1

1 0 1

1 1 1



Finally we have the XOR gate. It's a special version of the OR gate in that it only outputs true when... ok wait hold on er...



Ok normally XOR gates are only ever 2 inputs so in all honesty, I have no clue if LBP2 only outputs 1 when only 1 input is one, or all but 1 input is one... so uh... let's stick with 2 outputs for now and you guys all have homework to go mess around with the XOR gate to find out what does what, ok? Besides experimenting is what LBP is all about, am I right?



Basically XOR is a one or the other gate, but not both. If one input is on it outputs true, but if none of them or both of them are on, it outputs false.



s q OUT

0 0 0

0 1 1

1 0 1

1 1 0



Now on the forums I personally suggest we all use the accepted mathematical symbols for logic gates



NOT : ~

AND : ^

OR : v

XOR : X

The actual symbol for XOR is a cross in a circle but thats hard to type, so Xx is easier.



Finally lets go back to the NOT symbol, as it has a neat little property. If you apply the not gate to any of the other logic gates it flips their values, making them the opposite of their use. Commonly this is represented by putting the letter N before their name, NAND, NOR, XNOR, etc.



Whats awesome in LBP2 is you don't even need to use the not gate, as each of the other 3 logic gates has the NOT gate built right into them as a toggleable value, just hit square over your gate and select the not toggle on them to stick an invisible NOT gate right after them. Yay for MMM being awesome!



Let's see the effects of not on the main gates.



NAND makes your gate output true when ever one or more inputs are off. It's like a reverse OR gate!



NOR outputs true when everything is off! Neat!



XNOR becomes a very special, highly valued logic gate, as a test let's look at it's truth table and you can guess what it's name is.



s q OUT

0 0 1

0 1 0

1 0 0

1 1 1


If you guessed its the EQUALS gate, you get a gold star!

This is an awesome way to verify that both inputs are the same, either off or on.


Next let's cover some basic practice for making your logic in LBP easy to use.


First off, name everything! First and foremost your microchips. Give them a good name that shows what they do. In 3 months if you come back to your level and look at your logic, if there's more than 4 logic gates in it you probably will have 0 clue how it works, or even what it does.

Second, you can name your inputs and outputs too! To add an input to your gate when you don't have something to connect yet, stick a battery outside the MC and grab its wire and attach it to the inputted gate in your MC, then break the connection. Now if you minimize your MC you'll see an input on its left side, neat! But it gets cooler!


Maximize it again and hover over the input, where the glowing triangle gets big and hit the edit button. Lo and behold, you can edit the name of said input, and if I recall correctly you can apply a not value to it too. Whoa!


Name it and then minimize your MC. Grab your battery and hover the wire over the input. Look at that, the name of that input now shows up. This is an extremely important thing to do to keep your MCs user friendly. A well made MC won't need the user to even maximize it up to figure out what connects to what, and they'll be able to hook it up with ease!


the same goes for outputs, once you establish an output connection the same way (hook a gate up to something outside and then break the outer connection to make a static output) you can then hover over it and edit it, and thus name the output so the user knows what value comes out.


MMM is pretty awesome,


Now let's do one last tweak to make your MC even more user friendly. If you've noticed that hooking two different inputs or outputs to gates that are close to each other, the lines for the outputs are really close to each other. It's actually pretty easy to separate them farther apart and evenly space them!


Instead of directly hooking up the gate to the outer input of your MC, grab the wire and click just inside of your mc where you want your wire going out. This should stick down one of those little circles with an arrow that represent a continuation of the line. Then grab the output of THAT little circle and put THAT to the output. This allows you to force the outputs to be farther spaced apart, letting your MC become even more user friendly. Alright!


Long winded but the information was universaly helpful to me.


-Butane

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum