Beta
Mr. White
Loading description...
Puzzles
Algorithms
Recursion
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
The reference solution cannot solve some cases. For example, the case
[1, 2, 2, 1, 2, 4, 0, 1, 4], w = 3, l = 3
has the following solution:['M', 'H', 'M', 'H', 'M', 'M', 'H', 'H', 'M']
. But the reference solution returns['?', '?', '?', 'H', '?', 'M', 'H', 'H', 'M']
.The rule for
people[i] = 0
is not explained in the description. The reference solution and all test cases assume the following rule: ifpeople[i] = 0
then the i-th person and all neighbors of the i-th person are innocents (H
). This rule does not follow from the general rule "there are at least 0 monsters adjacent to me".Should the 'special rule' be removed, and the description/reference solution fixed? Or should the special rule be mentioned in the description properly?
I prefer to make all rules consistent and remove the special rule for 0.
Random tests sometime fail with the following message:
The reference solution in tests should return
'Situation is paradoxical'
.This looks fixed
I am confused by the 'paradoxical' situation that you mention. I cannot see how the people represented by
1
are not monsters.The input is
[0, 0, 0, 1, 0, 1, 0, 0, 0]
(From description). Which, in a square, looks like:Now, since
at least 0
must always be true, we can infer that all0
s are human:And now, since we know all surrounding people are Human, the
At least 1
s must definitely be lies -> Monsters.Where is the paradox? Am I missing something??
This is indeed not a paradox, just tested with my solution and it gives what you found.
Is it simply not tested? Or how does your solution handle paradoxes (I don't quite understand how a situation can be a paradox at all.)
It is a paradox if a special rule for 0 is assumed. This rule is not explained in the description (but it is hinted there). See my issue above.
Current test set up is insufficient. You need:
Fixed test section (tests with a hardcoded solution. Put as many edgecases as you can think of here.)
Many more random tests. Ideally something like 50-100. (You can run the tests in a loop)
Read this for info.
There are 50 ish tests now, including 12 difficult fixed tests, including edge cases (so difficult I had to rewrite some code). I think it is better...
Looks pretty good. I am not going to look too closely (since I still want to solve this properly) but I will mark as resolved and if anything else comes up later someone can raise it as a seperate issue.
Still no one has solved the kata... do you have any idea why that is?
Since it is in beta, a lot less people see it until it is approved. Also it is not a very easy kata, so people have to spend more time on it (meaning lots of people won't be bothered/have time).
All you can do is fix any issues that come up, and just wait. Maybe if you go around completing some of the other beta katas that are waiting for people to solve them, it will give this one good karma ;)
It's been two weeks at this point... I wonder if there is something wrong?
Users can mutate inputs, ruining the tests. You need to send the user solution a seperate copy of the input lists than what you use in the tests. (See my solution for example.)
You should also have some fixed tests, including some edge cases (for example the paradoxical situation)
I'm confused--how would I send them a separate copy?
Read through this help page: https://docs.codewars.com/languages/python/authoring#calling-assertions it contains some hints how to avoid problems related to input mutation and example code.
I used copy.deepcopy... I think I fixed it. Thank you for the feedback!
You did!
I still think there should be some fixed tests (And many more tests!) but the main issue here is solved. I will open a seperate issue related to tests.
If this Kata is worthy for approval (I'm not saying it necessarily is), how long ish would it take for that to happen?
A kata is only ready for approval once enough (probably at least 10?) people have solved and rated it, and if the average rating of it is high enough. It also needs to have no active issues. Once all of that is met, a mod or high level user will do a final check over it and approve it.