Original Post
Hey,
This might sound a bit odd, but I'm working on a simulation of sorts and having a slight mental block.
This would probably be best described if I used a real life sort of example (note, this is not a school assignment or similar).
Imagine you have 100 of some currency (I'll use dollars).
You walk into a room that has a random number of people in it, all in random locations.
Your objective is to pass out all your money, making sure everyone gets some of it.
The catch is, you are to give more money to people that are closer to you (not just more, but proportional).
So as an example, if there are 2 people in the room, and you know 1 is 5 feet from you and the other is 10 feet from you, the one 5 feet from you should get double the amount you give to the other person. In this case, you'd give the nearest guy 66.66 dollars and the other guy 33.33.
What would be the appropriate method to distribute the money when you do not know the number of people, but you do know how far each one is from you?
I hope that makes some sort of sense. Thanks for any and all help.
Edit:
Nevermind. I think I've got it. My only issue now is that the farther the 'people' are away, the less the distance impacts how much they would receive (that's trivial though).
This might sound a bit odd, but I'm working on a simulation of sorts and having a slight mental block.
This would probably be best described if I used a real life sort of example (note, this is not a school assignment or similar).
Imagine you have 100 of some currency (I'll use dollars).
You walk into a room that has a random number of people in it, all in random locations.
Your objective is to pass out all your money, making sure everyone gets some of it.
The catch is, you are to give more money to people that are closer to you (not just more, but proportional).
So as an example, if there are 2 people in the room, and you know 1 is 5 feet from you and the other is 10 feet from you, the one 5 feet from you should get double the amount you give to the other person. In this case, you'd give the nearest guy 66.66 dollars and the other guy 33.33.
What would be the appropriate method to distribute the money when you do not know the number of people, but you do know how far each one is from you?
I hope that makes some sort of sense. Thanks for any and all help.
Edit:
Nevermind. I think I've got it. My only issue now is that the farther the 'people' are away, the less the distance impacts how much they would receive (that's trivial though).