Project 4: Lunch as a team sport

It's a beautiful day for a picnic. You and your family have arrived at the national nature reserve and you are all quite hungry. Unfortunately for you, so is the wildlife. The good news is that the animals don't want to eat you. The bad news is that they want to eat your lunch.

Each of you has two sandwiches, two fruits, an egg and a cookie. The food items are in a bag that shields them from view. Carefully removing a food item from the bag takes 10 seconds, and putting a (possibly partially eaten) food item back in the bag also takes 10 seconds. Food is visible to animals only at the end of the 10 seconds when removing it from the bag, and food becomes invisible to animals at the start of the 10 seconds when putting it back in the bag. You can have only one food item outside the bag at a time.

It takes a total of 3 minutes to eat a sandwich, 2 minutes to eat a fruit or egg, and one minute to eat a cookie. To eat, or to access the bag, you must be stationary. It is possible to walk while holding a food item, so that you don't have to put it back in the bag, but you need to stop again in order to eat. If you spent 1 minute eating a sandwich, then put it in the bag, you only need 2 minutes to finish the sandwich once you take it out of the bag.

The nature reserve picnic area is a field of size 100m by 100m. You can see the entire field, including the positions of the other family members and what they're eating, even if they're on the other side of the field. You can also see all of the animals at any moment in time. The whole family starts at the center of the field, which we'll call (0,0). Each family member can independently wander around the picnic area at a speed of up to 1 meter per second. The simulator will run in timesteps of 1 second, so that means you can choose any location within 1 meter as your next position.

Scattered throughout the area are monkeys and geese. These animals start in random positions. The simulator will use a random number seed to allow repeated simulations with the same starting positions. In the absence of any perceived food the animals walk/fly in a random direction until they hit the edge of the field, at which time they choose a new random direction. However, when they see a person holding food, they are attracted to the nearest such person as described below. Animals see food that is out of the bag even when you're not eating, such as when you might be walking holding your cookie.

  1. Monkeys are very good at sensing food within a 40m radius, and will approach the nearest human that is eating or has food outside the bag, but will not get closer than 2m. (If you move towards them, so that they are momentarily nearer than 2m, they will move away from you on the next simulation tick to try to maintain the 2m distance.) However, if there are three or more monkeys within 5m of you, the monkeys gain the courage to grab whatever you're eating and gulp it down right away. Monkeys walk at the same speed as humans.
  2. Geese can fly at 3 meters per second. Geese have a particular liking for sandwiches, and will make a direct line for the closest person they see eating or holding a sandwich. If a goose makes it to within 2m of your position, they swoop in and grab your sandwich. The goose with the newly liberated sandwich leaves the simulation (it's taking the sandwich to the nest). Geese can see sandwiches from a distance of up to 20m.

Each family member will be controlled by a group's code. So, in a family of 4, there will be four groups represented. All groups in the simulation receive the same score, which is calculated as described below. The game is co-operative, so all family members should be trying to make the entire group happy. The time for the simulation will be a parameter T. We'll start with a leisurely lunch of one hour, but will vary T see how quickly you can complete the task with various animal distributions. What is the minimum T that would enable all family members to eat their entire lunch assuming no interference from the animals?

  1. Each person in the group earns 3 points for finishing a sandwich, 2 points for finishing a fruit or egg, and 4 points for finishing a cookie. (Everyone likes cookies best, right?) So there are 16 points available per person. No points are awarded for partially consumed items when time expires, or for items stolen by animals.
  2. The group as a whole earns the total number of points of all family members.

The simulation has several parameters, which are:

T
The length of the simulation, in seconds.
f
The size of the family.
m
The number of monkeys in the simulation.
g
The number of geese in the simulation.
s
The random number seed.

We'll discuss in class what values for the parameters are the most interesting. At the end of the project, we'll select a few parameter configurations and run tournaments to see which players are the most effective. For example, suppose there are 8 groups and families have size 4. Then we can perform 70 runs to cover each subset of four players, and calculate the average score for each player across all runs. For the tournaments (and for your development) we'll have access to Google cloud accounts that will allow us to perform many runs.

Some initial things to think about:

  1. What are the advantages and disadvantages of spreading out versus staying near other family members?
  2. There is no direct communication between family members. You can only react to what you see other players doing (e.g., moving, eating). How might you try to coordinate your actions despite these limitations?

Ken Ross 2019-10-21