Rooks Movements


#1

I can’t get the 100% because of the validator named “ANYBODY IN THERE”
Everything else is OK except this edge-test.

What is the content of this test or at least the main idea ?


#2

It’s testing the same thing as the first test case - other units on the board but not blocking your rook.


#3

I pass the first test case without efforts, so I’m clueless on this issue with the validator.


#4

I have exactly the same problem.
I can pass that cas if I force the number of pices to zero and just render the output without considering any input on piece positions. (But then of course, I fail all other cases)


#5

Can one of you try again? There was an extra space at the end of the input lines on that validator.


#6

Nope, still only 75% and its the first case that messes up things.
I have gone through my code multiple times, and can’t find anything wrong.
An extra space at the end would not affect my solution, I think.

I work in Python3 at the moment, if that could matter.


#7

As far as i can see the input does contain linebreaks instead of spaces for the piece piece output. I get:

d5
2
0
c1
1
e8

instead of

d5
2
0 c1
1 e8

when i loop twice as often as the input for the number of pieces suggest.

Also the Output description is wrong, instead of

A list of space-separated combination

it should say

A list of combination, one per line,

or

A list of line-break seperated combination


#8

I used an extra raw_input()+concat in case the input is incomplete.
Thanks you for the tip !


#9

I don’t know for other languages, but in C++ you can replace this block in the given code sample:

for (int i = 0; i < nbPieces; i++)
{
    string onePiece;
    cin >> onePiece; cin.ignore();
}

By this:

for (int i = 0; i < nbPieces; i++)
{
    string onePiece;
    getline(cin, onePiece);
}

Or this:

for (int i = 0; i < nbPieces; i++)
{
    string color;
    cin >> color; cin.ignore();
    string position;
    cin >> position; cin.ignore();
}

It’ll make the program behave like described in the statement. If you don’t do this, cin will stop as soon as it comes across a space (or a line break), which is why you need twice as many iterations to get all the input.


#10

I just ran the default code, seems fine to me (prints ANSWER, even if there are multiple lines to read). :confused:
The default code isn’t written as you see it, but generated from a template (as CodinGame supports a lot of languages).


#11

Well, try to print the input without touching anything, you’ll see it misses half of it.

for (int i = 0; i < nbPieces; i++)
{
    string onePiece;
    cin >> onePiece; cin.ignore();
    cerr << onePiece << endl;
}

#12

Of course, because you changed the default code to only read a part of the input.
Reset it and try again (top right corner).


#13

:man_facepalming:

I must have removed the color for some reason and completely forgot about it. Thanks for pointing that out! Disregard everything I’ve said then.


#14

Wait, actually I just checked my past VODs and I didn’t change the default code at all, there was no variable for the color when I first checked this puzzle a week ago: https://www.twitch.tv/videos/337816275?t=05h55m29s

That’s really weird because I’ve just tried the puzzle in incognito mode and on other browsers, the code sample is similar to your screenshot. Resetting the puzzle gives a correct code sample too.

There must have been some wizardry at work that day lol.


#15

I noticed your comments on discord and fixed it but you’d logged off so I couldn’t let you know. Sorry for any confusion caused.


#16

Oooooh, that explains everything then, there was no magic after all :(.

Well, thanks for fixing it Robostac!


#17

Hi everyone, I’m squatting this thread instead of creating a new one.

I too have an issue with validators on this one, my code (obviously not hard coded) passes all manual tests with flying colors but only get 25% on the validation ones. The first one is green but not the others and I’m puzzled as of why. I’m confident the number 2 and 3 should be good, I may have an issue with output sorting on the last case if we have several pieces we can take since it’s not tested by default (but I’m 99% sure it should be ok)

I’m using PHP if it helps…

Thanks in advance for the help.