I currently am making a game, where two users take turns making sounds. These are stored numerically in arrays (x axis for the turn, and y representing a sound.). After they both have had a turn, the arrays need to be compared, to see if they match. I wanted to do this with counters that walk through each position of both arrays, and see if they match. This is what I have so far, I'm pretty sure its not working. I want it to output a 1 if it is incorrect, which is not currently happening.
-
Comparing two numerical arrays
-
@pd_zord There were a couple of errors in your screenshot, [t int] doesn't work for me in vanilla, also the [==] object gives a 1 if the two elements are the same, I gather you want to do the opposite and need to use [!=]. It's also worth noting that the order of operation is quite important here because the right inlet of [!=] needs to receive the value before the left inlet in order to compare the two correct values.
I have attached a patch that I think works, have a look and see if it helps.
compare_tables.pdYou can also have a look at the [compare-any] abstraction in the list-abs library for doing this kind of stuff.