def mealAt(self, automata): ''' Effect deferred method. ''' pixelelID = automata.pixelelID() meal = Meal(essentialPixelelID=pixelelID) amount = self.food.at(pixelelID) if amount > 0: portion = Portion(pixelelID, amount) meal.append(portion) # else meal is empty return meal
def mealAt(self, automata): ''' Effect deferred method. ''' meal = Meal(essentialPixelelID=automata.pixelelID()) for pixelelID in self.food.pixmap.pixelelIDsAt(automata.position): foodAt = self.food.at(pixelelID) if foodAt > 0: portion = Portion(pixelelID, foodAt) meal.append(portion) # meal may be empty of portions. All portions are non-zero amount ''' meal.calories() may be greater than 255 i.e. max pixelel value defined by graphics framework. assert that the caller will clamp it to 255 ??? ''' return meal