The circuit inverters (I on map) produce a magnetic field which will reverse the direction priorities that Bender should choose when encountering an obstacle.
So it’s obviously your second way of understand this. But be careful that Bender will keep this mode (inverted decisions) until he reaches another inverter.
I’m passing all validation tests except for “All together” and I can’t figure out why. What are the usual culprits when passing all the validation tests except “All together”?
Hi,
Man, thats puzzle is great. I try to teach myself programing and I belive this is the first puzzle that tought me something beside simple coding. It made me think before I started to write code and after that it showed, that my thinking time was way to short!
It took me few hours to finish, I wonder how much time does it take on average.
The thing is that even if you code the loop flag correctly, that is only if you pass the same location with the same direction, the multiple loop is tricky. In that level you pass the same point with the same direction more that 3 times. so for that level you have to make the loop flag come up only after more occurrences of the same location and direction. they meant INFINITELY after all…
Direction and location are only 2 parts of Bender state. Is he drunk? Is he “inverted”? How many walls has he broken so far? You just need to keep track for all of this.
If bender passes some point for the second time and he is drunk as well as the last time and he moves in the same manner as last time AND he has not broken any new wall since the last time - you may assume that the loop is infinite.
Hello,
I am hoping someone can help me. I can’t find the bug in my code but there must be one (or many) because the code does not pass tests 11 and 12 (loops and multiple loops). It looks like the original position of Bender is never met because I never see my debug trace “cerr << DEBUG << endl” (it’s C++). But I guess the loop is when you meet the original position of Bender. I pasted my code on PasteBin (for a day only). It’s here https://pastebin.com/nNUThyHb
If anyone can help I would be very grateful, it’s driving me crazy.
Marie
Just wan’t to share a couple of annoying bugs in my code in finding LOOPS.
First I made an array of “states” to see if I am at the same coordinates with same modes. A state looked like this string “YX(normalMode?)(beerMode?)”
This doesn’t work for coordinates bigger than 10, since Y=1, X=11 is the same as Y=11, X=1 when concatenated. So I just added a space between.
The second bug was that when you remove “X” cell in Breaker Mode this doesn’t work, so you should reset the array you use to check for repeating states.
Hope this saves you some time if someone’s stuck on this for as long as I was
I am having trouble with Breaker mode. My code isn’t actualy ‘breaking’ the ‘X’ character (i.e. removing it from the map). I am working with javascript:
if(charAtNewPos === 'X' && bender.breaker){
map[newPos[0]][newPos[1]] = ' '; // **here i am trying to change the value 'X' on the next position on th map to empty string **/
printErr( map[newPos[0]][newPos[1]] ) /* but in this next line, printErr prints 'X' as if nothing changed *//}
i am working in javascript. this is a statement in the function that checks next position on a map. Map is a global variable.
I think it has to do something with the scope … any help ???
What’s the difference between loop and Multiple loop cases? I detect loops in both of them. When I print “LOOP” in the single loop test case it works fine but when I print “LOOP” as my first response in the multiple loop test case the console says “SOUTH” is first from expected answers.
I used a set of states to check for loops, but there’s a different solution: since there are only 16 distinct states Bender can have (4 directions, 2 breaker modes, 2 priority modes), you can say that you found a loop once you visited the same cell more than 16 times (via pigeonhole principle). Don’t forget to clear visit counters when you modify the map by breaking an obstacle.
Hi, my bender’s solution can pass all the tests and vaidation tests except for the teleport validation one.
Can anyone tell me what this test is ?
My bender store his position, his previous position, his invert state and destroyer state…