I have 10 numbers that are always changing but there's one that doesn't, how can i find that one number that is not changing and remove it so that all of the numbers are changing. Also if another number stops changing i want it to do the same as before.
The numbers come from moving objects/dots in my program. After a while one dot stops moving and i want to remove that number/dot. The numbers are the x cord of each dot.
So the end result that I'm hoping for is, random dots gets spawned and start moving, one stops and becomes removed, and so on..
I would suggest the easiest/most straightforware way to solve this would be wherever you are updating the x coordinate. Before you change it, test to see if it is the same as the previous value. From there flag it to be removed. If it is ok for it to be the same value twice in a row, but not say 50 times in a row, keep a counter of how many times it's the same in a row, when it passes a certain threshold, then flag it to be removed.
The easiest to program and most straightforward way to do this would be to simply check the distance between a dot and every other dot. This has the disadvantage of being extremely inefficent.
A more efficent method, but much more complex is a k-d tree.