Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
In the community puzzle āPorcupine Feverā you are give tuples of input with the number of sick (S), healthy (H) and alive (A) pigs. From my understanding and the input of pretty much all test cases S + H = A. Thatās not the case in test case āDead Farmā where a couple of times S + H > A and the only way to clear the validator is to overwrite A with S + H in the input. Is my thinking seriously borked here or is there a problem with the inputs?
Yes, there is a problem with the inputs.
Iām not sure how QC is done here, but the creator and/or approvers might be able to fix the problem? @Unihedron, @Wladek
I validated that one without even looking at the A count, so yeah, thatās a very plausible issue.
My suggestion would be to do the same; but if youāve got specific cases for me to fix, Iād gladly take care of them too.
Edit: oh wait, there is an explicit test case. Ok, here I go.
Counter-edit: looks like the author fixed already (fifteen minutes ago). Reload and try again?
Inputs are correct now. Thanks
Sorry to have validated that with an error. I did get an error but I thought I had forgotten something in my code, and after a little modification (probably a modification that doesnāt use āAā directly) all was ok.
I found the redundancy of information a little strange and I should have checked that.
Hey, I fixed that. I crafted the last two test cases ālarge farmsā with an automated script, which did not add up numbers properly. I did fix that later for the final test case, but I forgot to regenerate the second to last test case. Itās an embarrassing mistake which should now be fixed. Sorry for the inconvenience and thanks for sticking with it!
It says the output must be āY or fewer lines of integers of porcupines alive.ā. Putting aside how weird that sentence sounds, it just doesnāt match up with the example output.
The Y input is 3, but then all of the outputs are integers way higher than 3.
From what I understand (through some mental gymnastics, admittedly) is that Iām supposed to output how many porcupines are left alive between all the cages after the years pass. For the first test case, Iām supposed to output 168.
So, I tweaked my algorithm, and had 168 outputted. But then I get a failure message, saying it found nothing while expecting 164 (despite the output stream clearly having 168). After I uncomment the line that did the output, it then says it expected 168.
Iād really appreciate help understanding this puzzle, and why Iāve been getting that first failure notice I mentioned.
Output āY or fewer linesā means that you have to output at most Y number of lines, where Y is the variable indicating the number of years. This is because of the restriction ā(do not repeat "0"s after the first time)ā.
Essentially the requested output is the number of porcupines left alive at the end of every year. The first line of the output is the number left alive at the end of the first year, the second line is for the second year and so on. The output ceases once 0 porcupines are left regardless of the value of Y.
You are getting a failure notice since 3 lines of integers are expected in the output, namely 168,164 and 156. The console output will read your first line and compare it to the expected output, then read the second line and compare and so on. Since your first line of 168 was correct, it continued to read your second line, which you did not output. So the failure message popped out saying that it expected 164 but found nothing
I understand now, thanks I solved the puzzle.
ā[ā¦] saying it found nothing while expecting 164 [ā¦]ā
Codingame (for some weird reason) shows the diff on a per-line basis. The comparison thatās done is on line 2 where 164 is on the second line for the expected output but empty (hence ānothingā) on your actual output. More specifically, ā168[LineFeed]ā is the part thatās matched, ā[EndOfFile]ā is the remainder of your output, ā164[ā¦]ā is the remainder of the expected output.
So thereās that.
Itās unfortunate that I had to use the phrase āY or fewer linesā - I had previously considered āAt most Y linesā and āUp to Y linesā but I was not satisfied with all three of them. In the end I had to rewrite the entire sentence, breaking down the two-part segment into one single sentence. If you can suggest better wording for it now that you understand what I was trying to say, please let me know. Admittedly my english is not very good.
I think understand. Also, I suggest changing the wording to āY or fewer lines of integers, each being how many porcupines are alive at the end of their respective years.ā. Itās a bit wordy, but it gets the intent a lot clearer, which is what really matters.