Resetting computation of collatz conjecture with match and bang doesn't work
Hey,
I'm a programmer longtime now and I have started getting into max to kind of understand how you can do programming in it. I've coded the Collatz conjecture, but I don't understand two things:
1. Why doesn't the reset button work at all. (See comment)
2. Also for some values the sound kind of breaks completely and I need to restart it so it resets. Is this a familiar problem? How to solve it?
Thanks
i can confirm that cycle~ stops processing when it receives too many different numbers at the same moment.
while i think the object should not do that, i also think you should still avoid it anyway.
p.s.: hm, putting a line~ in between also kicks out the audio.
oops. mtof produces inf.
you need to limit its input to avoid this. (to note number 129 for 44 khz if i remember right,)
Thanks! But, why does the reset butting not work at all? I don't understand what I'm doing wrong :/
But, why does the reset butting not work at all? I don't understand what I'm doing wrong :/
Well, the final elements of the sequence are 4, 2, 1 and not 4, 3, 2, 1...
And then you have an 'order of execution' problem here with the reset. You can solve that by using a trigger object ( e.g. [ t i i ] ). Whenever you have a message going from one outlet to multiple destinations, you have to pay attention, whether the order in which these messages are being distributed is in line with what you want to achieve.
Thank you for your answer.
I don't understand how to do it though. The thing is that I have multiple destinations going to one inlet:
the output of the collatz and the initialization. Also how can you tell max that "look you have a loop here, treat accordingly" for the case of simply the reset? I'm not sure I understand can you please show me the solution?
The order that objects receive messages are dependent on their screen positions (messages go right to left). Two different fixes (and the decision logic in more traditional Max usage) attached, Hope this helps!
\M
Thanks!