what object sends values ​​greater 0 to left and ​​below 0 to the right out ?

hgh's icon

Object needet that:

sends values ​​greater than 0 to the left and send values ​​below 0 to the right output

thanks,
hgh

Peter Castine's icon

Use a [gate] with one of the comparison objects. You will need to be careful about processing order.

Peter Castine's icon
Max Patch
Copy patch and select New From Clipboard in Max.

For instance:

broc's icon

[if $i1>0 then $i1 else out2 $i1].

hgh's icon

cool: my favorite is [if $i1>0 then $i1 else out2 $i1]

thank you very much!!! ;)

$Adam's icon

You can also try [sadam.split 0] from the sadam Library, although that would send the values below 0 to the left outlet and above 0 to the right. Setting the @strict attribute will let you decide if you want to get the exact 0 values on the left or on the right.

Peter Castine's icon

Yes, [if] can be a handy shortcut. But you should be aware of the gate technique, which can be a very useful approach for a multitude of tasks.

BTW, being in a hurry, I made a silly mistake in the example I posted. Fixing it is left as an exercise to the reader. One way would be to replace the [gate 2] with a graphic gate, but extra points for solutions w/out UI objects.

ShelLuser's icon

@Peter

I'm always (usually) in for extra points (and interested in puzzles). It seems you forgot that the comparator (< 0) gives out 0 or 1. 0 closes the whole thing and 1 only opens the first gate.

Max Patch
Copy patch and select New From Clipboard in Max.

A possible solution is adding 1 to the outcome, as such:

But, as you said, this does indeed leave a little vagueness as to the 0.

SO, how many points did I score? ;-)

Peter Castine's icon

The [+ 1] after the comparison was what I was after and you get full points for that!