[Community puzzle] Xorandor


#1

This topic is about the puzzle Xorandor.

Feel free to send your feedback or ask some help here!


#2

Hi !
I love puzzle Xorandor !
My programm passes all the tests in the IDE, but don't pass 2 tests of the validator.
So something doesn't work as expected, but I have no idea about what... and no way to test anything more...
Would it be possible to get one more test in IDE, that my programm doesn't pass, so that I can improve it and understand what is going wrong with it?
Thank you for this fantastic puzzle !


#3

Got it !
I did'nt understand that electric lanes could run along the borders !

[ ..@ ..]
. |..... |
++.... ++
| ..........|
0........ 0

Have a good day !


#4

I think the Xnornandnor test case should without change switch or input.
The right side, the "[ ^ ]" with a not under produce true and light the led


#5

It looks like the LED element requires all its inputs to be 1 to light up.
This could have been stated clear in the problem statement.


#6

It’s written but I searched a bit to find it in the statement.


#7

Oh yes indeed, now I see it too :slight_smile: Used to dismiss the intro as a bla-bla-bla part.


#8

it's a shame that you didn't describe switches behaviour with an example.


#9

Why do I have 49% when submitting, but 100% in test cases?
I mean I make brute force with all possible combinations but this seems strange to me


#10

now I got 67% but I still am missing fork and big one


#11

Try these tests:

TEST 1

23 18
      [@]         
       |          
     [ & ]        
      | |         
   +--+ +--+      
   |       |      
 [ | ]   [ & ]    
  | |     | |     
+-+ |     | |     
|   |     | |     
|  [~]    | +--+  
|   |     |    |  
|   +--+--+    |  
|      |       |  
|    [ | ]     |  
|     | |    [ & ]
|   +-+ ++    | | 
|   |    |  +-+ | 
| [ | ]  |  |   | 
|  | |  [~] |  ++ 
|  | ++  |  |  |  
|  |  |  |  |  |  
1  0  0  1  1  0

ANSWER

I2
I6

TEST 2

31 23
       [   @   ]       
        | | | |        
  +-----+ | | +-----+  
  |       | |       |  
  |     +-+ +-+     |  
  |     |     |     |  
[ ^ ] [ - ] [ - ] [ = ]
 | |   | |   | |   | | 
 | ++ ++ ++ ++ ++ ++ | 
 |  | |   | |   | |  | 
 | [ > ] [ > ] [ > ] | 
 |   |     |     |   | 
 | [ | ] [ ^ ] [ + ] | 
 |  | |   | |   | |  | 
 ++-+ ++ ++ ++ ++ +-++ 
  |    | |   | |    |  
  |   [ > ] [ > ]   |  
  |     |     |     |  
[ + ] [ = ] [ + ] [ + ]
 | |   | |   | |   | | 
 | ++ ++ ++ ++ ++ ++ | 
 |  | |   | |   | |  | 
 | [ > ] [ > ] [ > ] | 
 |   |     |     |   | 
 | [ | ] [ = ] [ & ] | 
 |  | |   | |   | |  | 
 ++-+ +-+-+ +-+-+ +-++ 
  |     |     |     |  
[ & ] [ + ] [ & ] [ = ]
 | |   | |   | |   | | 
 0 0   0 0   0 0   0 0

ANSWER

K5
  • danBhentschel

#12

I pass both test cases :confused:


#13

Well the code you sent me before didn't pass these tests. :slight_smile: Maybe you should send me updated code, and I can take another look?

  • danBhentschel

#15

This problem is fascinating to me, but as someone who is pretty new to coding I have no idea how to even begin approaching it. Any hints?


#16

Maybe you should try some other puzzles instead. Even though this is the puzzle of the week, it has only been solved by 22 people, with a 9% success rate. Both of these indicate extreme difficulty.

That being said, here's the general approach that I took. First, I parse all of the symbols into objects with collections of inputs and outputs. Some objects simply pass their input value to all outputs (wires) and others apply logic to modify inputs on output (switches and gates). Then I "connect" inputs and outputs based on proximity. This creates the test model.

While building the model, I make a list of modifiable objects (switches and sources). Each object is binary in that it has two possible states. Any time there is a problem with N binary unknowns, I tend to solve it by running a loop with a counter from 0 to 2^N. Since N never gets too large in this problem, it is a fine approach.

For each loop iteration, I decode the counter into a binary number and apply the digits to the associated objects in my model. If the output of the model is good, then I add that number to a list of potential solutions. Then, it's just a matter of selecting the correct solution according to the puzzle criteria.

  • danBhentschel

#17

Great puzzle! I got 100% on the test cases but fail the Fork validation case, not sure what's up. I've tried both the examples posted above by player_one, and gotten the right answers. Ideas?


#18

Okay, give this one a try:

19 17
         [@]     
          |      
        [ & ]    
         | |     
      +--+ +--+  
      |       |  
    [ & ]   [ | ]
     | |     | | 
  +--+ |    [~]| 
  |    |     | | 
  |    +--+--+ | 
  |       |    ++
  |     [ | ]   |
[ & ]    | |    |
 | |    ++ +-+  |
 | |    |    |  |
 | |   [~] [ | ]|
 | |    |   | | |
 0 1    1   0 0 1

Answer

I1
I3
  • danBhentschel

#19

finally made it after adding like 1000 conditions :smiley:


#20

That one comes up unsolvable in my code, so that's a really good lead on the issue. Thanks!


#21

YES! Found the issue, which I suspect is the same one Bibiche had. I assumed when looking for a horizontal wire like +-*+ that there would always be a space after the last plus. But, the plus could be the last character in the line, and in those cases my code was not evaluating that horizontal wire. I fixed it by adding a space to the end of every line of the diagram.

Looks like I am the only published solution right now. I hope other folks publish theirs, I'm curious how other people tackle this!