Question: Write a Prolog program to solve a 12-piece TopSpin puzzle2. The main predicate must be named solve_ts and should take a list representing a permutation
Write a Prolog program to solve a 12-piece TopSpin puzzle2. The main predicate must be named solve_ts and should take a list representing a permutation of numbers from 1 to 12 as an argument. The predicate should print the sequence of states which represent the solution.
Top-Spin is a puzzle consisting of 20 numbered round pieces in one long looped track. You can slide all the pieces of the loop along. There is also a turntable in the loop which can rotate any four adjacent pieces so that they will be in reverse order. This in effect swaps two adjacent pieces and the two pieces on either side of them. The aim is of course to place the pieces in numerical order.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
