Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I remember there is also a sequel,where the proisoners don't know the initial state of the bulb.
Unfortunately, I didn't work on this one locally (Couldn't be bothered to set up the local tests with this one), so I don't have the same collections of attempts.
I am curious to see your code when it was not passing to understand why. Would you like to share it? You could help me make this kata better.
I am respecting the conditions of the notes section. I can see that the message has changed. My living_room function has logic which depends only on prisoner_number, lightbulb, and previous_visits. I do not have code outside of the living room function, and I haven't introduced any additional data structures. Update: I managed to pass after shuffling around the logic.
I am not sure about what makes your solution wrong, probably something related to the Notes section, with all the rules to respect. Anyway the fork posted by Kacarott has been approved and the error messages should give you a better idea of what the problem is. Let me know if you still can't figure out what is wrong.
Yeah good catch. Closing the suggestion.
It is not easy from the tests understand why your solution is wrong. Now, the error messages should be more helpful. They will always tell you if the prisoners made an assertion too early or if they didn't make any. Anyway, if you read that message it means that your solution is probably not respecting some of the conditions in the Notes section. Let me know if you still have problems finding out what is wrong.
I found it on Mathematical Puzzles: A Connoisseur's Collection, by P. Winkler. I don't know if he is the author of the riddle.
I forked from yours to change the last message to
The prisoners waited too long to make an assertion. (This might be caused by using state)
, then approved the forked version. Thanks for the help.There is actually already a "Cheat test" section, which provides the
living_room should be the only name in the global scope
message if necessary. The random tests do not actually check that any further, and so I am not sure why it was included in their error messages.As for state, the tests are designed to make solutions using state to fail, but it is difficult to know whether a failing solution did indeed use state, or because of improper logic. The messages I use in the fork is:
One of the prisoners made a false assertion. (This might be caused by using state)
which was about as good as I could think of to handle this.can it be split to two seperate errors?
The current error messages are not great, hopefully they will be fixed soon. It probably just means that your solution is wrong.
Using state means if you are somehow storing information in between function calls. The actual problem is that one section of tests only have one kind of error message, so even if you fail the tests 'normally' it still tells you that you shouldn't use state, etc.
Probably your solution simply doesn't work, but also doesn't break any rules. I have posted a fork with slightly better messages, hopefully it'll get approved soon.
Python Fork to improve the error messages. (See issues below for context)
Why This Error Message?
Description
When I have nothing in the global scope and do not even know what a state is, I still cannot pass with this error message:
In my code living_room does not have any custom attributes. Can you please suggest to me what might be going wrong here?
I have also found that this only occurs when I assert the prisoners' freedom.
It also only appears on a number of tests and not all of them, namely in 8~9 concentrating in the latter part of the tests.
I can post my code if needed but I will not put it here in the question.
Hypotheses for what might have went wrong
Please help. Thank you!
Loading more items...