This does not happen very often so it's likely your code is failing for some other reason, can you give an example of a test case that is failing for you?
Have you read the thread started by MariusAFT below?
A simple example:
(Note This before position is not possible to create with the rules we are using.)
Before: ..O*O*..
After a move to 1: .***O*..
The flipping stops at the * piece at 3 and the O at 4 does not flip.
The answer you are getting is what happens if you let the array index become negative.
You should ensure that you stop when you get to zero, and don't go negative.
This does not appear to currently be explicitly documented though. I will clarify the description.
This comment is hidden because it contains spoiler information about the solution
Math.floor is (re)implemented on the first line.
This does not happen very often so it's likely your code is failing for some other reason, can you give an example of a test case that is failing for you?
Have you read the thread started by MariusAFT below?
A simple example:
(Note This before position is not possible to create with the rules we are using.)
Before:
..O*O*..
After a move to 1:
.***O*..
The flipping stops at the
*
piece at 3 and theO
at 4 does not flip.See my reply below
This comment is hidden because it contains spoiler information about the solution
Yes.
https://hexdocs.pm/elixir/master/Kernel.html#length/1
Thanks, I think I've fixed it now.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The test failure messages should show the inputs that failed.
I've updated the description, hopefuly that is helpful.
I'm not sure about the wording, suggestions for improvement are encouraged.
This is similar to the example case:
The answer you are getting is what happens if you let the array index become negative.
You should ensure that you stop when you get to zero, and don't go negative.
This does not appear to currently be explicitly documented though. I will clarify the description.
This comment is hidden because it contains spoiler information about the solution
This is a strange one, because the acceptance tests do not test for this.
If you also want to capitalize the last word add this code to the end:
.sub(/(\w+)$/,&:capitalize)
This comment is hidden because it contains spoiler information about the solution
Loading more items...