Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @blasterpoard,@TBali and @FredericLocquet.
If you have any issues, feel free to ping them.
Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Created by @Lisa-Has-Ideas,validated by @blasterpoard,@TBali and @FredericLocquet.
If you have any issues, feel free to ping them.
Really nice Puzzle. Well written and easy to understand with a real-life context !
Glad you liked it
(Thanks for the posting)
Maybe I’m misunderstand something here.
After the first step, the total dough is only enough, to make only one doughsquare (side=1.389) that is big enough for one more biscuit. How can the solution then be “2” ?
Hi Hackintosh –
Thanks for playing. You are definitely on the right track, and good question.
Now ask yourself:
After the baker cuts out the one biscuit from the 1.389 side “DoughSquare”, then what is left of the dough, and what can be done with what is left.
(I’m trying to make this vague, while still giving some hint/direction.)
Does that help? If not, feel free to message me.
The last pastry is a particular case. Having enough dough may not be sufficient. Check the prompt of the exercice, you’ll figure it out ^^
I can’t figure out how to develop a formula for the number of biscuits a frugal baker would make. Any tips for how I could do this?
Apparently I cannot pass the last validator (#14 “A gazillion micro-biscuits Validator”), even if I can pass the same test in the IDE.
Hi TGGO –
I don’t want to be too clear in this answer, but here are some vague unrelated comments that might get you going:
You want to do something WHILE you can. You want to cut out biscuits while the square is big enough
“Negative space” (in art) is the idea of looking not at the object (biscuit) itself, but at the space around it.
Imagine an ideal scenario where the frugal baker is the most frugal he can possibly be, how much wasted dough is left at the end? (It’s not zero.) If you know this answer, then you can determine the actual usable dough and get a formula from that.
I hope that helps. Thanks for playing.
Interesting. I haven’t heard any problems like this before. Can you send me your code, and I’ll have a look??
I have the same problem, but my case might be somewhat special:
I previously solved the puzzle in python, that worked perfectly.
Now I’m trying to solve it in pure bash for fun.
Since bash cann’t handle floating point numbers, I multiply everything by a “just big enough” number to be able to work with integers. Then, to avoid overflows when calculating areas, I divide them back temporarily with another “just big enough” number which unavoidably truncates some hopefully unimportant digits from the end. “Just big enough” is important because bash alone is extremely bad at arithmetics and the process can easily time out with too big numbers.
So I’m guessing the problem in my case
I could change my code to deal with the middle two (and even test it on a custom case), but that’s a lot of work to handle a case that might not even exist, and there’s still no guaranty that it will handle the actual validation test without overlow or precision errors. And since I can’t see the output of the validation test, those two are indistinguishable…
It would be great if you could provide me another test case which only differs from validatior 14 in nonzero digits and have roughly the same initial side to diameter proportions as well.
Thanks for the nice puzzle and for your help!
Hi RaceBot —
Thanks for playing my puzzle.
I’m just going to message you Validator14 if that’s okay
For others interested, the problem Bold Goblin had was just that the PI value used in the solution was not precise enough. It had to be more exact than 4 decimal places.
Hi all.
I am wondering if anybody can help me here. My code passed all tests but failed when submitted.
It won’t pass the validator#9 (Who kneads that Validator) and validator #13(Micro World Validator).
I coded this using Typescript, Javascript and Go and all have the same problem. As for the Pi I used Math.PI in Typescript and Javascript, and math.Pi in Go.
Was there anyone experiencing the same?
Thanks in advance btw.
My solution using math.Pi works in Go so it’s not a Pi accuracy problem. If you want to send me your code I can have a look?
A common mistake is that people round their intermediate results and then use the less accurate values to do further calculation. Check whether you have fallen into this trap.
Thanks guys I just resolved this issue and reached 100% completion.
Apparently, there are some mistakes in my logic to count the frugalBakerMade each iteration. I’m actually surprised my previous code was able to passed the tests.
after experimenting with the precision requirements of PI, 3.14159f substituted in for PI passes the largest case in the validators. Still, safer to stick with library provided constants
For the record, I learned so much about donuts, biscuits and doughs while solving this puzzle lol. Real life scenarios are the coolest puzzles
could you tell me how i can know the side length of the the new DoughSquare after i take as much biscuits as i can