I’ve passed every test case on the IDE but the LOOP validator keeps failing and i have no idea why,
to find a loop case i store the current state of bender(coordinates,direction,breaker,inverted) in an array.
at the start of the next coordinate it checks if the current state already exists, signaling a loop, also, every time an ‘X’ block is destroyed the array is cleared
the game loop is a while that breaks when it encounters the ‘$’ character, if it doesn’t find it before bender repeats a state, it prints ‘LOOP’
i’m using python
Comme dit dans le titre, j’obtien 100% des test en local mais 92% en les envoyant (All together ne passe pas)
J’aimerais savoir si il est possible d’avoir les sorties d’erreurs ou les détails du test pour pouvoir corriger mon code, parse que la je bloque totalement.
par rapport au dernier test “boucles multiples” pour éviter d’envoyer LOOP alors qu’il n’y a pas besoin, je sauvegarde dans une liste (java) l’état du Bender à chaque fois qu’il rencontre un # ou un X. Ensuite il me suffit de vérifier dans la liste si l’état n’était pas déjà présent. Si oui alors LOOP.
Je me suis bien amusé en codant ma solution. Un peu d’organisation that all. Un truc c’est quand il boucle j’ai utilisé le temps… Par contre des bières infinies
Je rencontre un souci assez particulier avec certains cas de test. Le 1er et 3e test passent sans problème, mais pas le deuxième. J’atteins bien le point de sortie (que j’appelle Gateway) donc gateway === currentLocation. (tableau de coordonnées).
Mais quand je suis arrivé sur le point, j’ai une erreur qui affiche Trouvé “N”, attendu “S”. Etant donné que la sortie se trouve tout en bas à droite et que je rencontre un ‘mur’, il me semble normal que je fasse le changement de direction, c’est à dire EAST -> NORTH. Mais je suis déjà arrivé, alors pourquoi me demande-t-il une nouvelle direction?
Encore plus bizarre, j’ai soumis mon code et il passe le test sans problème… Des idées?
Hi everyone,
I’m facing a weird issue with some test cases. For example, the 1st and 3rd pass without problem, but not the second. I’m on the ‘$’ named ‘Gateway’ in my app, so currentLocation === Gateway. But an error raised and display: Found “N”, expected “S”. Because the gateway is on the right bottom of the map and there is a ‘wall’, I think it is normal to change the direction, thus EAST -> NORTH. But I’m already arrived, so why this asks me a new direction?
Even more weird, I submitted my code and the test is now correct… Any idea??
OUTPUT:
SOUTH
EAST
EAST
EAST
NORTH
WEST
WEST
WEST
WEST
SOUTH
SOUTH
SOUTH
SOUTH
SOUTH
EAST
EAST
EAST
EAST
EAST
In your output when Bender comes across the first obstacle he is going EAST and it looks like you make him look NORTH next, which is wrong.
In that case, Bender always looks at SOUTH - EAST - NORTH - WEST, in that order and starting from SOUTH, no matter what his current direction is, so the correct output is:
SOUTH
EAST
EAST
EAST
SOUTH
EAST
SOUTH
SOUTH
SOUTH
Note that you can check the input and expected output of each test case by clicking the small menu icon on the top right of the test cases boxes.
So I’m having some trouble with validating a handful of tests and I’m not really sure what the issue might be. On the “All together” test my pathfinder is navigating as intended up until the teleporter, after which he passes straight through it without relocating. The “Teleport” test is functioning properly, and when I submit the test passes fine (though there seem to be some other tests failing). When I print the coordinates of his next move he’s certainly crossing the location of the teleporter, but any logical checks on colliding with it fail.
For people that are stuck are stuck on “All together” validation, I wanted to share how I solved for my code.
I too was stuck, until I noticed what I believe to be a problem in the instructions.
The instructions state “If Bender passes over a teleporter, then he is automatically teleported to the position of the other teleporter and he retains his direction and Breaker mode properties.”
But in order to pass “All Together” validation Bender needs to retain direction, breaker and inverted properties.
I coded only to maintain direction and breaker since that is all that is described, once I added logic to teleport to also retain inverted, it passed validation.
Hello,
it seems I didn’t truly understand rules of the game. I am stuck on inverter map. The map looks like this:
–########## --# I # --# # --# $# --# @# --# # --# I# --# # --# # --##########
This is first way I understand inverters:
So bender starts going south, then he gets to an inverter which reverses his direction decisions. He then starts going west from an inverter until he reaches barier, then he goes north and east until he reaches another inverter which turns him to south and bender will be stuck looping.
Second way is this:
Bender don’t change direction on inverter, he only changes his direction decisions and keeps going current direction until he reaches obstacle, which will change his direction.
None of these ways lead bender to finish (the second way will keep bender stuck in the upper part of map), so can you please explain me how these inverters work, as LOOP is wrong answer?