93 lines
1.9 KiB
Go
93 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
)
|
|
|
|
func init() {
|
|
log.SetFlags(log.Lmicroseconds)
|
|
}
|
|
|
|
type ingredient struct {
|
|
weight int
|
|
caloriesPer100 int
|
|
}
|
|
|
|
const (
|
|
bakingPowder = 92
|
|
beans = 100
|
|
beetroot = 43
|
|
butter = 774
|
|
butter2 = 630 // Cake butter thing that's not real butter
|
|
cabbage = 25
|
|
carrot = 35
|
|
cherry = 63
|
|
chickenBreast = 98
|
|
chinamix = 64
|
|
chocolate = 516
|
|
cocoa = 363
|
|
cornstarch = 346
|
|
cream = 232
|
|
egg = 150
|
|
fatPork = 393
|
|
flour = 338
|
|
haluskymix = 355
|
|
ham = 98
|
|
hardCheese = 330
|
|
hotdogs = 250
|
|
ketchup = 92
|
|
lentil = 116
|
|
meatRoll = 210
|
|
mexicomix = 59
|
|
milk = 64
|
|
mistakemeat = 230
|
|
mustard = 30
|
|
olives = 151
|
|
onion = 23
|
|
pasta = 175
|
|
pastaSauce = 84
|
|
peas = 84
|
|
porkLean = 143
|
|
postCheese = 78 // Posni sir
|
|
potato = 86
|
|
rice = 130
|
|
sausage = 300
|
|
skyr = 62
|
|
sourcream = 70
|
|
starch = 400
|
|
sugar = 387
|
|
sunflowerOil = 828
|
|
tofu = 76
|
|
tomatoPassata = 21
|
|
tomatoPaste = 82
|
|
turkey = 111
|
|
vegetableMix = 50
|
|
water = 0
|
|
yeast = 185
|
|
zucchini = 21
|
|
jam = 278
|
|
)
|
|
|
|
// tomato 96
|
|
// olives 50
|
|
func main() {
|
|
var ingredients = []ingredient{
|
|
{280, chocolate},
|
|
{150, butter},
|
|
{400, sugar},
|
|
{300, egg},
|
|
{280, flour},
|
|
{200, jam},
|
|
}
|
|
|
|
var totalWeight int64
|
|
var totalCalories int64
|
|
for _, ingredient := range ingredients {
|
|
totalWeight += int64(ingredient.weight)
|
|
totalCalories += int64((ingredient.weight * ingredient.caloriesPer100) / 100)
|
|
}
|
|
log.Printf("Total weight: %dg", totalWeight)
|
|
log.Printf("Total calories: %dcal", totalCalories)
|
|
log.Printf("Calories per 100g: %dcal", totalCalories*100/totalWeight)
|
|
}
|