Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Hi
I have all tests passing but the final validation fails. Can I get a hint regarding the problem?
Why validator fails?
that was my question.
take a look at this screen cap
It seems that itās the one with a pawn that has been upgraded.
thanks, but I need something more specific. Iāve run custom tests and covered all possible promotions
Maybe not.
Someone on chat pointed out to me that the stub code for this puzzle was only reading 4 characters per move, but the promotion move is 5 characters long. The 5th test has the promotion move as the last move in the sequence, but the 5th validator has other moves after the promotion move, so for languages that depend on the string length to be correct, the 5th validator may fail.
I have fixed the stub generator to correct this problem, but it might affect anyone who started this puzzle before this fix was put in place.
Hello,
My problem is similar. Iāve passed all tests, but the 3rd validator failed.
Thanks for your help and ideas.
The third test focuses on castling to the right, short castling, or castling on the kingside. The third validator focuses on castling to the left, long castling, or castling on the queenside. Make sure that you have handled this properly for both white and black.
If you still canāt get it, try making your own tests.
Thank you player_one
I only focused on short castling.
Iām having trouble with the last validation test too. I have done several tests by myself and it looks to be working correctly so i have no idea why is it failing. Canāt we have some more info about whatās the validator doing? Itās hard to debug something if you have no idea what you are looking for (i mean, i canāt even know if its an error thrown by the compilator or is just that my code is not well designed since it only says that the validator failed).
Iām doing it in C++, if that helps.
Thanks in advance.
The last test is about black promotes with pawn from field c2 by taking a white piece (rook) that is placed on field d1. The input has a fifth character that indicates that black wants to promote the pawn to a rook.
So:
Field c2 is empty resulting in 2pBQPP1 will be converted to 3BQPP1
Field d1 contains a rook resulting in 2KR3R will be converted to 2Kr3R
Hope this helpsā¦
I was just making some tweakings to the code and it seems to be working fine now, which is weird since i havenāt made any important changeā¦ Anyway, thanks for your detailed answser
Iām also struggling with just āValidation 5ā failing. I tried making custom tests with more moves after it and they passed for me.
Thanks, but this is the last test case, we needed some information about the last validator, since most of us passes the test cases but fails at the 5th validator.
I have tried custom test cases, still canāt get it work. Maybe the problem is with my algorithm? It is pretty straightforward, so i post it here:
0. i check if the āen passantā, or castling situations occur, if yes, i make changes according to them (this step is unrelated to pawn promotion)
So i assume if there is an 5th character, then pawn promotion happens, no matter what (since it is stated that āAll the moves are legal and can be made following standard chess rules.ā).
What could the problem be, is a mystery.
I dont see any problems in the logic you describe. I assume other pieces wont be the problem.
Some things that come to mind to check:
If anyone wants to PM me their source code, I would be willing to try to debug the problem. I have looked at the 5th validator numerous times, and I canāt see anything obviously tricky about it.
Okay, so one person has sent me code, and here is where Validator 5 tripped this person upā¦
Validator 5 moves the king diagonally at one point, and this particular user was using the distance the king travelled to trigger a castle. If distanceTravelled > 1 square, then must be a castle. That kind of thing.
Problem is, if you calculate the distance of a diagonal move, it is > 1, but is decidedly not a castle. Things went downhill from there.
Does this help anyone? Does anyone else want to send me code to look at?
He used the wrong distance, the right one is ||.||ā (sup distance), neither ||.||2 (euclidian distance) nor ||.||1 (Manhattan distance).