The logic in LBP2 is amazing, it lets us do incredible things. Alas however, some things require a unbelievable level of complexity.
That is why computers use user friendly code to be programed. It lets us do things without having to work out all the logic. So pose I want to use 4 switches to control a set of lights.
If any ONE switch is ON the light is green.
If any TWO t is red.
now for one its easy, use a XOR gate with 4 inputs.
but for any 2, but only 2?
this can be done, and it is not even the most difficult thing to do. but it is a order of magnitude harder than just 1 switch on.
OR I could say:
This handles it all, and I could easily add another color for 3 switches or add 20 more colors and 100 more switches. Now in implementation you would add a "code block" to your circuit board, it would open up and you could place things like ifs and loops, and such on it. rather than typing it all out.Code://"var1-4" are variables
Get input(switch1)=var1; //gets the input coming from switch1, a number between -100 and 100
Get input(switch2)=var2;
Get input(switch3)=var3;
Get input(switch4)=var4;
arithmetic(var1+va2+var3+var4)=TotalInput; //adds all the inputs together, all ons are worth 100, offs are 0. this allows for analog handling.
IF(TotalInput==100) THEN //if the total is 100 then one switch is on
Give output(100,green_light); //send a full on to green
Give output(0,red_light); //send full off to red
ElSE IF(TotalInput==200) THEN
Give output(0,green_light);
Give output(100,red_light);
ELSE //if its isn't 100, or 200 then both lights should be off
Give output(0,green_light);
Give output(0,red_light);
http://getsatisfaction.com/littlebig...tle_big_script

