Bender - Episode 1 - Puzzle discussion


#105

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


#106

Bonjour,

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.

Merci d’avance


#107

Bonjour,

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.

l’état du Bender c’est :

  • mode casseur (oui/non)
  • mode inversé (oui/non)
  • coordonées du Bender
  • direction du Bender
  • nombre de mur détruits (état de la map)

#108

Hey,

I pass the ‘breaker mode’ test but don’t pass the validator . Any tips?(edge cases i should try to solve)

N.S


#110

The concrete algorithm is needed for a concrete response. Although, did you took in count that ‘#’ walls are undistroyable?


#111

The “#” walls are then made of concrete. :grinning:


#112

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 :confused:


#113

J’ai un comportement étrange. Je viens de résoudre le puzzle, le score est à 100% mais les 2 “success” de s’activent pas :frowning:


#114

I can see you’ve got them since the 31st of March.


#115

Free as in free speech AND free beer. :open_mouth:


#116

English below

Bonjour à tous,

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

Trouvé : N
Attendu : S


#117

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.


#118

Hey,

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.

What could I be missing here?

Tele1: 7, 8
Tele2: 10, 10
Walls: 9
SOUTH, Next:
SOUTH, Next:
SOUTH, Next: I
SOUTH, Next: B
SOUTH, Next: B
SOUTH, Next: B
SOUTH, Next:
SOUTH, Next:



SOUTH, Next:
SOUTH, Next:
SOUTH, Next:
SOUTH, Next: W
WEST, Next:
WEST, Next:
WEST, Next:
WEST, Next:
WEST, Next:
WEST, Next: S
SOUTH, Next: T
SOUTH, Next:
SOUTH, Next:
SOUTH, Next: (Wrong)
SOUTH, Next:
SOUTH, Next:
EAST, Next:
EAST, Next:
EAST, Next:
EAST, Next:
EAST, Next:



#121

@DollarAkshay
@Soc
@carnival187
@ddhung1989
@oxmolol

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.


#123

Can someone help me on how to start? I created a 2D array and I am not sure how I should do to fulfill the rules requirement. Thank you.


#124

Use a structure to save the grid.
Loop until Bender reaches the exit: check the position of Bender, if it’s a special tile, apply the effect.


#125

Is it just me or is there a glitch in the expected output for “Obstacles”?

The “correct” result is:
SOUTH
EAST
EAST
EAST
SOUTH
EAST
SOUTH
SOUTH
SOUTH

But there are no inverters, so how could he go S,E *3, then S?!?

Shouldn’t it be:
SOUTH
EAST
EAST
EAST
NORTH
WEST X 4
SOUTH X 5
EAST X 5

Thank you!


#126

There is no error in the correct output.
You should read carefully the statement, especially the fourth bullet.


#127

Thanks nicola. I realized this upon waking up this morning and was hoping to delete my thread before anyone noticed… lol.

From now on, I will assume all errors are of PEBKAC nature :blush:


#128

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?

Thank you very much!