Question: Use this to program a Futoshiki problem in Python using the backtracking strategy. Futoshiki Futoshiki ( inequality ) is another number puzzle game that has

Use this to program a Futoshiki problem in Python using the backtracking strategy.
Futoshiki
Futoshiki (inequality) is another number puzzle game that has appeared in Puzzle
Communication Nikoli. Like Sudoku, the goal of Futoshiki is to complete an \times
output2024/1/2918:35 page 18 #24
18 Project: Logic Puzzles
Latin square with the digits 1 to . Rather than using the 3\times 3 subsquares of Sudoku,
the puzzle contains inequality constraints specifying that some cells must be greater
than or less than their neighbors.
Try it yourself
Try to solve the following puzzle. Tip: start with the four squares in the lower
left.
<
>
<
>
>
Solution
The four squares in the lower left must contain 4-3-2-1 in a cycle. Checking
will show that the top-middle squares must then contain 4 and 1.
1234
4321
3142
2413
<
>
<
>
>
Modify your Sudoku solving program to solve Futoshiki puzzles. Again, the key is
encoding the constraints. The simplest approach is to make a valid method with one
check per inequality. Remember that youll need to distinguish between constraints
where both variables have been assigned and constraints where one or both variables
are still undetermined
The solution should look like:
[2,4,1,3]
[3,1,4,2]
[4,3,2,1]
[1,2,3,4]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!