How to solve this logic logically without trial and error

I met the slant puzzle in Ubuntu. I want to solve logic logically, not by trial and error, etc.

The rules are simple:

  • We must fill in all the fields with a right or left slope.
  • The number of slopes touching the number must be equal to this number.
  • Loops are not allowed on the board. those. Inclined contours should not form loops.

Puzzle:

Question

Automatically resolved answer:

enter image description here

Where to begin?

+8
algorithm logic graph puzzle
source share
2 answers

Instead of left and right skew, I use a forward slash (/) and a backslash (\).

Take one square with corners (x1) (11), where x is just 1. There is one of them in the upper left corner. Suppose that the slope on this square is a slash that connects two 1. These 1 are “used up,” and all the squares touching them must have lines that do not touch the numbers. But this leads to an impossible situation, because we will have a slash both on the left and below our square, which means that the remaining 1 concerns two deviations. Conclusion: if you have a square with three 1s, then the line on this square should touch an angle that is not equal to 1 . This rule may not apply at edges and corners, but if you have 1 in the corner, you should draw a line touching that corner.

The numbers 1 and 3 are symmetric and using the same logic, we get another rule: if you have a square with three 3, then the line in this square should touch two out of three three .

There are more general rules, but they do not apply in corners. There should be squares around the square in question. Let’s take the square opposite 1 (x1) (1y), where x and y are anything, including a number without. There is one of two squares from the lower left corner. Suppose that the slope on this square is a slash that connects two 1. These 1 are “used up,” and all the squares touching them must have lines that do not touch the numbers. But this leads to a round around the 1st. Conclusion: if you have a square with two opposite 1s, then the line in this square should not touch these two 1s . This rule may not apply at the edges of the board.

Numbers 1 and 3 are symmetrical, but the previous rule uses the “no loops” rule, and there is no symmetric rule “no sideline loops”, and therefore there is no rule having two opposite 3.

Now that you know which line touches 1, you can conclude that no other line can touch it. We can generalize this argument to the following filling rules: if the number x is tangent to the rows x, then all other neighboring squares have lines that are not tangent to the number . And symmetrically: if the number x is the angle of (4) squares with lines that do not touch the number, then all other neighboring squares should have lines that touch the number .

Following the link " Gokigen Naname ", I found more rules. One of them is about two adjacent 1 (11), but Mvarden has already covered it.

These rules are not enough to resolve the issue. There are probably other rules. But in the end, the algorithm may have to be guessed.

+2
source share

Logically is a very broad term. As Orbling noted in the comments, a rollback can be considered logical. You can also “logically” understand how to solve it by translating it into a logical formula. From the comments I am collecting, you are trying to implement a solver that looks like perhaps a common Sudoku solver.

An easy way to implement a solver, similar to one for Sudokus, is to search for specific patterns. For the puzzles created by the program you are linking to, I can say with sufficient confidence that this should be enough to solve them without guessing or returning.

Some examples of obvious patterns are: <11> and >33< . Especially 2 has some nice "transitive" properties. For example: <12...23 -> <12...23< (with 2 ... 2 an arbitrary amount of 2 s). Try your solver with different examples, and when it gets stuck, I'm sure you found an example that can teach you a different template.

+2
source share