0
$\begingroup$

I tried to write a program to solve a Skyscrapers puzzle. Currently I'm teaching it to find the next steps out of nopes (values which cannot be present on the field) values and clues.

So far the field looks like this:

      3   5 3 4

    = = = = = = 
   | | |6| | | |   
    = = = = = = 
1  |6| | | | | |   
    = = = = = = 
3  | | | | |6| |   
    = = = = = = 
   | |6| | | | |   
    = = = = = = 
2  | | | |6| | |  
    = = = = = = 
3  | | | | | |6|  1
    = = = = = = 

    3 2 3   3  

Here also the Values(V) and the nopes(numbers) per row I have so far:

6    |5,6  |V6   |3,4,5,6|5,6|4,5,6

V6   |6    |6    |1,4,5,6|1,6|5,6

5,6  |3,6  |6    |1,2,5,6|V6 |6

6    |V6   |4,6  |1,2,3,6|6  |6

1,2,6|5,6  |4,5,6|V6     |6  |6

5,6  |1,4,6|1,5,6|6      |5,6|V6

Now the weird thing is I inserted the nopes to a program which checks the clues and the permutations per row depending on the present clues, nopes and values. The strange thing is according to the nopes and values per row it cannot guess any new nopes or values out of the permutations.

I have the solution of this puzzle and don't see any violation on any field with nopes and clue:

{5, 2, 6, 1, 4, 3},
{6, 4, 3, 2, 5, 1},
{3, 1, 5, 4, 6, 2},
{2, 6, 1, 5, 3, 4},
{4, 3, 2, 6, 1, 5},
{1, 5, 4, 3, 2, 6}

Did I overlook something here? What is the next step to solve the puzzle? Are there any nopes set wrong on the field?

$\endgroup$
0

1 Answer 1

2
$\begingroup$

First note:

The 5 in row 1 must be in R1C1 (your value/nopes force this).

To make progress, look at:

The 5 in the bottom row. It can only be in column 2 or 4. Suppose it is in column 4. Now consider where the 4 in the bottom row can go. It cannot be in C1, since we would then only see 2 buildings from the bottom. It cannot be in C2 or C3, because we would then see at least 4 buildings from the left. So it must be in R6C5, forcing R6C1 to be 3.

Grid

Now look up the third column. The R6 entry can be only 1 or 2, but the R5 entry cannot be 5. Since we can only see three buildings looking up the column, the column must be 6,3,4,5,1,2 (reading top to bottom). This forces R6C2 to be 1, which means we can see three buildings up column 2. This is a contradiction, forcing R6C2 to be 5.

$\endgroup$
1
  • $\begingroup$ Thanks a lot it looks my algorithm and me for some reason failed to see that connection in the mentioned row. Weird because with puzzles he does this step to solve. $\endgroup$
    – Sandro4912
    Feb 6, 2021 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.