Instead of saying - 1 * (expression), you could say - (expression), as boolean values are interpreted as 1 or 0 in arithmetic, and you can subtract those as well like you can do with (almost) any value.
Hi @quedo - no the error is with your code. I pasted it into the editor and there's even a helpful error message explaining what is going wrong:
Returned solution incorrect for fixed string = abcdefghijklmnopqrstuvwxyz:
'nopqrstuvwxy`abcdefghijklm' should equal 'nopqrstuvwxyzabcdefghijklm'
Your code is not mapping the letter m to z correctly. The reason is that, for m the value of c that you are using corresponds to c=122. Now insert c=122 into your code and see what value appears after your calculations.
Instead of saying
- 1 * (expression)
, you could say- (expression)
, as boolean values are interpreted as 1 or 0 in arithmetic, and you can subtract those as well like you can do with (almost) any value.I missed the point that I know the number of pits
but there is one single pit, so it cannot be anywhere else than at (1,1)
I fail to understand how this one could be True:
_ _ _ _
_ P _ _
_ _ _ _
_ W _ G
The agent feels the wind in (0,1) and (1,0), but pits could be at (2,0) and (0,2).
This comment is hidden because it contains spoiler information about the solution
Hi @quedo - no the error is with your code. I pasted it into the editor and there's even a helpful error message explaining what is going wrong:
Your code is not mapping the letter
m
toz
correctly. The reason is that, form
the value ofc
that you are using corresponds toc=122
. Now insertc=122
into your code and see what value appears after your calculations.It certainly works.
Please read this: https://docs.codewars.com/training/troubleshooting#post-discourse
This comment is hidden because it contains spoiler information about the solution