Yesterday, as I was regarding a bunch of bananas in the kitchen, I mentally dashed off this code snippet:
#typedef enum {
Banana_Green = 0,
Banana_Yellow,
Banana_Spotted,
Banana_Brown
} BananaRipeness;
#typedef enum {
Take_Banana = 0,
Hold_Out_For_Banana_Bread
} BananaAction;
– (BananaAction) takeBanana:(BananaBunch *)bunch
{
if ( (0 == [bunch count]%3) && [bunch ripeness] > Banana_Yellow ) {
return Hold_Out_For_Banana_Bread;
}
else {
return Take_Banana;
}
}
People who live in houses where banana bread is made will, of course, understand at a glance that when the bananas are getting on in ripeness and there is a multiple of three bananas remaining, one does not take a banana, but rather one holds out for banana bread, lest they face the ire of their fellow residents. Some debate is possible whether the ripeness threshold should be past yellow, as in my code here, or whether one should start holding out earlier, even though the bananas still have a few days left.
It is very good to be in a house where banana count is important.
Code notes: this is written in (more or less) Objective-C, and assumes there is already defined a collection called BananaBunch. I generally avoid multiple exit points in a function, but this one is simple enough that I decided it was OK. I haven’t bothered checking the code for errors, it’s just not that sort of exercise.
Interesting. Now you’ll have to turn it into a widget for estimating at what point in time a certain bunch of bananas will reach their peaks. First, the peak of edibility, then banana bread-ability. just type in the date and time of purchase, humidity, and whatever else effects the aging of bananas, including whether said bananas have used Botox, etc.
Then there’s my way where when they reach ‘peak’ stick them skins and all into the freezer and when you have the proper number of perfect bananas defrost them in the sink (they sort of liquify to a degree and are easily slipped from their skins mushy and perfect) and use.
That Girl has pointed out that there is another factor in the decision: whether there is someone nearby who will be able to cook the banana bread before the bananas go totally bad. In Prague, I would take the banana no matter what the ripeness and count factors were. Around here, it’s about how whether the bananas will last until the weekend.
And now you just need to come up with something to determine how much rice should be left in the pot to guarantee a pudding.
Just be sure to include the following in the coding:
… And it’s lovely rice pudding for dinner tonight.
Actually, I enjoy a good rice pudding.