-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor everything #42
Comments
|
Maximum nitpick mode engaged, I hope you don't mind me criticising every little bit. I only care for code quality. Make it the best app (die BWESTE)! |
It's okay. THIS WILL BE THE BEST APP!!!!11 SCHAUNS HER! |
I'm concerned the remaining factor/dec logic might be wrong. Each tick, we want to decrement the first drink's alcohol mass by 0.00015 times the total alcohol mass, not times the first alcohol mass only. But we use the remaining factor here, so I don't know if it is what we want. Maths! |
I think, my original logic is correct. Say you drank a drink (lol) at a time point A and it has alcohol mass M in it, so you use public static double getBac(Mixture mixture, User user) {
if (user.isMale()) {
double R = 2.447 - 0.09516 * user.getAge() + 0.1074 * user.getHeight() + 0.3362 * user.getWeight();
} else {
double R = -2.097 + 0.1069 * user.getHeight() + 0.2466 * user.getWeight();
}
r = (1.055 * R) / (0.8 * user.getWeight());
return (mixture.getAmount() * mixture.getPercentage() * 0.8) / (user.getWeight() * r);
} So you need only a factor so you can get the remaining alcohol mass from this drink at a given point in time. |
Why would the mass decrease when you multiply it with a huge value? My logic would be fine if we stored a remaining alcohol mass in Drink, instead of a remainingFactor. I suggest we use the new system and revert if it turns out to be wrong. |
Why store something in the drink anyway? We have a taking time and the alc-mass. Everything could be calculated on the fly. |
You drink a drink with 50mg alcohol at time 0h. Well, you are probably right, since there's the distributive law, I derped the night I wrote the proposal.
For this to work, we need to set a time epoch t = 0. We mustn't consider any taking times except the one of the first drink. That's probably why I thought this wouldn't work. |
Pretty much closed/done with #43 |
Ingredient
s(name, alcohol content, quantity [ml])
A = quantity [ml] * alcohol content * density of alcohol (0.8 g/ml)
.Recipe
with the constructornew Drink(Recipe r);
(name, recipe, consumption time, remaining factor)
remaining mass = remaining factor * recipe.mass()
.(name, sex, age, height, mass, drinks)
r = blood density (1.055g/ml) * waterQuantity() / 0.8 * mass
.drink[i].mass()
.bac = alcoholMass() / mass * reductionFactor()
.The text was updated successfully, but these errors were encountered: