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.
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".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??
Some tests with small images, small
dx
and without backslash (r\
) can be useful for debugging.Tests expect lines longer than width.
For example:
Error message (formatted):
x_pos
,y_pos
,background_object
, ...) (or simplyx
,y
,background
)Hi,
duplicate of too many kata
JavaScript version is completely not.
This comment is hidden because it contains spoiler information about the solution
Don't round results!
https://docs.codewars.com/authoring/kata/floating-point/#do-not-use-rounding-or-stringification-to-work-around-problems-with-precision
https://docs.codewars.com/languages/python/codewars-test/#approximate-equality-tests