J
jimnl69
I have a problem that to me seems complex. I put it here in the perl
forum because this is how I need to solve it. I've translated the
scenario into a psuedo scenario below but the concept is identical.
Here goes:
I have 10 people: p1..p10
I have 2 products: milk and cookies
I have a list of all 10 people:
p1 gets cookies
p2 gets milk
p3 gets either
p4 gets either
p5 gets milk
p6 gets cookies
p7 gets either
p8 gets cookies
p9 gets milk
p10 gets cookies
I turn the assembly belt on and out comes cookies and milk, random
order. I need to distribute, one at a time, to the 10 people in a way
that somebody doesn't get seconds, before everybody else capable of
getting that item gets firsts. I've been trying to figure out how to
keep indexes of where each item type was but the problem is the people
that get both. How do I store who got what? Now, here's the kicker.
I need to store this in-between program runs. If it runs every 5
minutes, one time I may get 20 items and one time I may get 2.
Whatever the case may be, it's a continuous loop that needs to start
where it left off.
forum because this is how I need to solve it. I've translated the
scenario into a psuedo scenario below but the concept is identical.
Here goes:
I have 10 people: p1..p10
I have 2 products: milk and cookies
I have a list of all 10 people:
p1 gets cookies
p2 gets milk
p3 gets either
p4 gets either
p5 gets milk
p6 gets cookies
p7 gets either
p8 gets cookies
p9 gets milk
p10 gets cookies
I turn the assembly belt on and out comes cookies and milk, random
order. I need to distribute, one at a time, to the 10 people in a way
that somebody doesn't get seconds, before everybody else capable of
getting that item gets firsts. I've been trying to figure out how to
keep indexes of where each item type was but the problem is the people
that get both. How do I store who got what? Now, here's the kicker.
I need to store this in-between program runs. If it runs every 5
minutes, one time I may get 20 items and one time I may get 2.
Whatever the case may be, it's a continuous loop that needs to start
where it left off.