Numbers Question..

Okay so here's my question.

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.
Last edited on
Here's a question for you: What?

What numbers do you have, where are they coming from, how are they changing? Do you have any code?
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.
Okay I'll see if i can make it work.

Also i have another question, I want to find the closest dot to another dot, but this dot is controlled by me. Any ideas?
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.
Yes, I know of that method but can you give me a example of the kd tree I've googled it but i got large examples but not a small one like i need.
Topic archived. No new replies allowed.