Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Comparing values

Archive: 9 posts


Hi everybody
I'm working on a puzzle for a level in little big planet 2 where you have to count how many of two sets of objects are in a box, then press one of three buttons depending on if there are more blue, more red or an equal number of each.
I just need a little help with the comparison logic.
I originally had a selector with 10 outputs wired up to loads of or gates, which worked fine for finding out if there were an equal amount of each, but didn't work to find which had more if not equal.
I then tried using batteries with different power strengths, and can determine which has most now, but can't tell when they're both equal.

My question therefore is: Is it possible to compare the actual power values of output, so a 20% battery would only be said to be equal to another 20% battery? If so, how would I do it?

Thanks for any ideas and help you can give me.

Oh yeah, my current detecter is like this...


red tag sensor (signal strength) ---- /------more red
---- combiner -------- splitter ----
blue tag sensor (signal strength) ----/ ------more blue


Oh, and another thing, is it possible to boost the power output of a signal? Sometimes the output is only 10% which doesn't always trigger my items properly.
2011-10-03 02:57:00

Author:
Unknown User


First, to each of your splitter outputs you could add a positional sequencer with a battery that covers the whole sequencer. Then you'll get a 100% output from the battery if there is any signal at all (if one signal is greater than the other).

Then to detect when the two signals are equal, feed those two batteries into an inverted OR gate.

As a side note, you may also find rtm223's adder circuits (http://www.lbpcentral.com/forums/entry.php?2107-Analogue-Logic-2-Sorting-amp-Addition) useful.
2011-10-03 03:34:00

Author:
Dr C
Posts: 122


I've been thinking about this, and think I have come up with a solution for you that doesn't involve analog signals at all.

Let's say you have a max of 5 blue objects and 5 red. On each object have a single tag.

Now make 5 blue tag sensors with each set to require 1, 2, 3, 4, or 5 tags. This way you will know how many objects there are by which tag sensors are lighted up.

Now copy these as a group and paste a new set. Select them again and switch the color to red so you have red and blue sets that both count the respective tags.

Take Red 1 and Blue 1 and run them into an XOR gate. Run that XOR out into two AND gates. Plug Red 1 into the other input of one of the AND gates, and plug Blue 1 into the second AND gate.

Now run Red AND into an OR gate, and Blue AND into another.

Do the same with Red 2 and Blue 2 tag sensors and run their respective AND gates into the appropriate OR gate along with 1. Do the same with the rest. At the end you should have 2 OR gates with however many inputs you have tag sensors for each color (in this case 5). Whichever OR gate is active is the one with more.

To determine if they are the same, run both OR gates out into an XOR gate, and invert the output signal on the XOR.

This will give you three distinct digital outputs. one if Blue is higher, one if they are equal, and one if Red is higher.

There's probably other ways to do it. I can think of a couple now, but I would stay away from analog values as much as possible with this just because, as you have found, it adds the hassle of dealing with analog to digital conversion.


EDIT-sorry, I meant for that last gate to be an XOR, not an AND. I have edited the post accordingly
2011-10-03 07:02:00

Author:
tdarb
Posts: 689


Thanks, I'll give the sequencer battery idea a go when I can get onto my PS3 later, I can't really do it requiring so many tags though as it's counting paintballs hitting a target so there will be no extra tags to count.

Basically, I'm recreating the counting game from the Wii's Big Brain Academy where the coloured balls shoot into a cup and you have to say which had more go in.

Again, thank you for the ideas, I'll let you know how it goes

Edit: The sequencer and batteries worked a treat! Thank you for the idea. I've put my test level online now, I just need to tweak it so that it's easier to count the balls now

http://lbp.me/v/6twqg8
2011-10-03 15:29:00

Author:
Unknown User


http://lbp.me/v/6twqg8

The word "entering" is censored in the description of your level. You might want to use another word instead?
2011-10-04 07:27:00

Author:
Slaeden-Bob
Posts: 605


The word "entering" is censored in the description of your level. You might want to use another word instead?
hahaha.... you said "level"...........
2011-10-04 08:08:00

Author:
evret
Posts: 612


Yeah I'd noticed that, was tired last night tho so I left it for the time being.2011-10-04 11:47:00

Author:
Unknown User


Analog comparing logic is quite simple really. Suppose you have three separate analog signals: first you want to figure out what the strongest signal is and next who's signal it is.

For this example I'll take 3 batteries of different signal strengths. In reality, the batteries are replaced by whatever logic produces these signals, of course. Wire those batteries into an OR gate. That gate will send the strongest signal through. Now we only need to determine which battery it belonged to.

For this wire each battery to the positive input of a signal combiner. Then wire the output of the OR gate (the strongest of the signals) into each of the combiners' negative gate. This will subtract the strongest signal from all available signals. The signal that matches the strongest signal will output as 0 from the combiner. Else the result will be a negative number.

Now we hook the output of each combiner to it's own sequencer. Stick a battery on the sequencer that is the full width of the sequencer's canvas and set the sequencer to positional. If a sequencer set to positional receives a negative signal, it will convert it a positive one. So, in case the combiner gives not 0, the sequencer battery will be triggered. Just stick a NOT gate behind every sequencer's battery now and there you are: you now know which of the batteries gives off the strongest signal.
2011-10-05 21:48:00

Author:
Antikris
Posts: 1340


Thanks for that, I've got it working perfectly (or so it seems to me) now. I changed the paintballs to fire and electricity so they're easier to see, darkened the background a little and added some music and prettified it with stickers and a background environment. Oh and I changed my randomiser from a spinning wheel with loads of tags to a randomiser ? box thingy, it's here -> Logic ball counting game (http://lbp.me/v/6twqg8).

It's eventually going to be a puzzle you have to get past in a level I'm working on
2011-10-06 09:22:00

Author:
Unknown User


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.