Skip to content
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

Formula for calculateCheeseCubeCoverage in pizza-pi is misleading #616

Closed
neilmayhew opened this issue Feb 13, 2024 · 2 comments
Closed
Labels
enhancement good first issue x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:rep/tiny Tiny amount of reputation x:size/tiny Tiny amount of work x:status/claimed Someone is working on this issue x:type/content Work on content (e.g. exercises, concepts)

Comments

@neilmayhew
Copy link
Contributor

The formula given is

pizzas = (cheese_dimension^3) / (thickness * PI * diameter)

It should be:

pizzas = (cheese_dimension^3) / (thickness * PI * (diameter/2)^2)

The formula given produces wildly incorrect results. However, if it's changed now it will invalidate all of the existing community solutions. Instead, I suggest a note be added to the instructions explaining that the formula needs to be used as-is rather than being corrected by the programmer.

I think it would also be helpful for beginners if the formula used ** rather than ^, since ^ is a valid operator in PHP but produces very unexpected results that are very hard to figure out if you don't already know PHP. Alternatively, the formula could use a superscript-3 Unicode character:

pizzas = (cheese_dimension³) / (thickness * PI * diameter)
@mk-mxp
Copy link
Contributor

mk-mxp commented Feb 14, 2024

@neilmayhew Even if the use of PI in that equation resembles calculating the area of the pizza, the exercise does not make that claim. "Lilly calculated an equation to determine [...] of some diameter (d)" in my eyes clearly enough says, that the formula is made up by Lilly.

Regarding the choice of characters: I will re-write the exercise soon and focus it on the use of arithmetic operators. That means, I will step away from that formula and use ³ as you suggest.

Edit: I confused the goals outlined in #578 .

@neilmayhew
Copy link
Contributor Author

Even if the use of PI in that equation resembles calculating the area of the pizza, the exercise does not make that claim. "Lilly calculated an equation to determine [...] of some diameter (d)" in my eyes clearly enough says, that the formula is made up by Lilly.

Technically, you're correct, but unless someone is playing very close attention they could easily miss this (as I did) and have a very hard time understanding what they did wrong (despite the fact that I've been programming for many years). It seemed natural to me to "fix" the formula, thinking that it was a typo. The instructions say the function should "return the number of pizzas that can be made" and so I tried to do that.

Perhaps these slight changes to the wording would help:

Lilly decided to use the following formula to determine …

  • And uses Lilly's formula to return the number of pizzas that can be made while rounding down.

@mk-mxp mk-mxp added enhancement good first issue x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:size/tiny Tiny amount of work x:rep/tiny Tiny amount of reputation labels Mar 31, 2024
@mk-mxp mk-mxp added the x:type/content Work on content (e.g. exercises, concepts) label May 24, 2024
@mk-mxp mk-mxp added the x:status/claimed Someone is working on this issue label Jun 5, 2024
@mk-mxp mk-mxp closed this as completed Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue x:action/improve Improve existing functionality/content x:knowledge/none No existing Exercism knowledge required x:module/concept-exercise Work on Concept Exercises x:rep/tiny Tiny amount of reputation x:size/tiny Tiny amount of work x:status/claimed Someone is working on this issue x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

No branches or pull requests

2 participants