//Get Matt to tell you wtf he wants for lunch - documentation
/* There seems to be some confusion over my previously posted code. It has been misunderstood that Matt.getFoodPreference() actually accepts input from a user. This is wrong for several reasons.
1. Matt is obviously an instance of the boy() class, not a user
2. getFoodPreference() is a method of the boy() class which discovers and returns the boy()'s food preference, whether the boy() is consciously aware of it or not.
How getFoodPreference works:
First off, Ensure that there are favourite foods:
----if there are no items in the favourite foods vector:
......check the boy()'s history of items eaten and pick the one he liked the most
......place it in the favourite foods vector
......if the boy has never eaten, exit the program with error message: "Invalid
......instance of boy object"
1. Determine how hungry the boy() is
----if int howHungry() returns 0 for not hungry, return(pickRandomFood())
......pickRandomFood() returns a random food item from the boy()'s vector of
......favourite foods
----The vector of favourite foods is ordered from most to least favourite
2. Check if the boy() has any cravings; cravings are stored in a vector ordered from most craved to least
----if so, sort through the vector from most to least craved foods and return the
----first one that matches the level of hunger (or exceed by up to 2 points)
----if all of the craved foods are too low, return the first combination of foods
----that matches or exceeds the level of hunger; using multiples of food if necessary
----but using as many different foods as possible
3. If the boy() has no cravings...
----iterate through the vector of favourite foods from most to least
----return the first food that matches (or exceeds by up to 2 points) the level of hunger
----if all of the foods are too low, return the first combination of foods
----that matches or exceeds the level of hunger; using multiples of food if necessary
----but using as many different foods as possible
*/
3 Comments:
If the first part was nerdy, then I'm not really sure what to call this one.
plus nerdy? super-plus-nerdy?
Then the hourlong discussion of food leaking off plates, and the ability to cache food to the serving cart would be madly nerdtastical
You write very well.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home