[Community puzzle] Xorandor


#22

This is a bit frustrating... I pass all test cases, plus the 3 posted by player_one (thanks for posting them, by the way), but when I submit it, it says that the "Big one" failed :sob:.


#23

Great puzzle. Several times I had to stop and ask "How the heck am I going to do that?" I love puzzles like that.

It seems to me that proper parsing of the input is the key. Once you figure out how everything is connected, the rest is pretty straightforward (but not necessarily easy).


#24

Okay... try this:

29 20
    [     @     ]   
     |   | |   |    
  +--+ +-+ ++  +-+  
  |    |    |    |  
[ = ][ - ][ - ][ ^ ]
 | |  | |  | |  | | 
 | | ++ | ++ ++ | | 
 | | |  | |   | | | 
 |[ < ][ < ] [ < ]| 
 |  |    |     |  | 
 |[ + ][ ^ ] [ | ]| 
 | | |  | |   | | | 
 +++ ++ | ++ ++ +++ 
  |   | |  | |   |  
  |  [ < ][ < ]  |  
  |    |    |    |  
[ + ][ + ][ = ][ + ]
 | |  | |  | |  | | 
 | ++ | ++ | ++ | | 
 |  | |  | |  | | | 
 | [ < ][ < ][ < ]| 
 |   |    |    |  | 
 | [ & ][ = ][ | ]| 
 |  | |  | |  | | | 
 ++-+ ++-+ ++-+ +++ 
  |    |    |    |  
[ = ][ & ][ + ][ & ]
 | |  | |  | |  | | 
 0 0  0 0  0 0  0 0

Answer:

K4
  • danBhentschel

#25

Well... It works too! But still no luck with the "Big one" after submitting :sweat: ... I don't get what could be so different between the test case that is visible and the other : longer input? Odd forks?


#26

Maybe you don’t choose the first solution.


#27

these were the hardest 50 points ever


#28

Same for me... After considering the case where the wires could run on the border, I still have the rondnanronX validator failing...
All others proposed tests in this discussion are OK with my code... So sad to be stuck at 83% with no way to end it up!

Could two wires be not separated by spaces (only when |)?
This would imply that the wires can be plugged into the GATE borders ([ or ])?


#29

Me too...a very difficult puzzle.
I am having the Switch! and BigOne validators unsolved. May be there are surprising constructs in the switches I have not thought of.
Any other suggestion of the diagram design that is not covered in the test cases?


#30

Now overcome the Switch!
Have the "Big One" validator remaining. Not sure was my program too slow to brute-force trying out all combinations, or was there an error in interpreting the diagram and constructing the Objects.


#31

Finally overcome this puzzle and earned 50 points.
The most difficult part is to handle the SWITCH. It added weight to the complexity by at least a double.

Here is my approach as a reference to other fearless coders.
I put the ASCII diagram on a grid, reference each box containing a character by (x,y).
By scanning the grid I identified the components marked within [brackets]. I created an object for each component.
(It was the first time I need to use advanced class inheritance features in CG. Good exercise!)
By tracing the wires in the grid, using the same approach commonly used in solving maze puzzles, I found out the links between components so that I created the links between them.
In the components, program the logic and add functions of get/set/toggle. I classified components as either variable or static. A list of variable components is prepared. Finally use brute force to toggle each of the variable components to try getting a solution. There are often multiple solutions. Sort the solutions by custom rules (in up to down, left to right order) to get the correct one.
I failed the first time because I made false assumptions about the wiring design. I rewrote the code about wiring then it passed the "Big One" test. I conclude that it was not time-out. It was logical error that cased failure.


#32

Thank you very much for this nice post. I'm sure it will help other coders as well, as it is basicaly what I had in mind when I wrote this puzzle.


#33

Thank You for this puzzle. It was the matter of honor for me to solve this as I am electronic engineer in the past. BTW I confused a little because of brute force solutions from everyone. And I bruteforced it too )). I mean just go thru all possible combinations input/switch and look if led is ON. But there are strict rules of logic that allow to make “true table”…may be we can restrict time slot for solutions…let say 5 times…to cut off brute force )


#34

hmm, this is strange. my code passes all the ide tests. it also passes the 4 example given in this post but it miserably fail at the last validator.
Any help please?


#35

I’ll give you the validator in a private message. Please reply here to tell us what was wrong in your code. Maybe we can add a new test case.


#36

To improve the success rate for this puzzle, I created this very tricky test-case:

13 16
 [  @  ]        
   | |          
  ++ ++         
  |   |         
  |[  +  ]      
[ - ] | |       
 | |  | +------+
 | +--+-----+  |
 +------+   |  |
        |   |  |
       [  <  ] |
          |    |
          0    0

Solution: I2
if your program can process it correctly, it will pass all validators.