0

python

Johnny has some difficulty memorizing the small prime numbers. So, his computer science teacher has asked him to play with the following puzzle game frequently. The puzzle is a 3x3 board consisting of numbers from 1 to 9. The objective of the puzzle is to swap the tiles until the following final state is reached: 1 2 3 4 5 6 7 8 9 At each step, Johnny may swap two adjacent tiles if their sum is a prime number. Two tiles are considered adjacent if they have a common edge. Help Johnny to find the shortest number of steps needed to reach the goal state.

26th Jul 2018, 7:25 PM
Vikash Yadav
Vikash Yadav - avatar
2 ответов
+ 2
The Q&A is just for code related questions - i.e. if you need help with a code - post a link to the code and say what you have tried so far and what kind of problem you have. If you have a coding puzzle, you can submit it to SL as a coding challenge. In this case, you didn't give the starting position so the puzzle can't be solved. You could also check here: https://www.google.ca/search?q=%22Johnny+has+some+difficulty+memorizing+the+small+prime+numbers.%22&oq=%22Johnny+has+some+difficulty+memorizing+the+small+prime+numbers.%22&aqs=chrome..69i57.3542j0j8&sourceid=chrome&ie=UTF-8
26th Jul 2018, 8:09 PM
David Ashton
David Ashton - avatar
0
my favorite color is blue good question
26th Jul 2018, 7:28 PM
Nicolass22
Nicolass22 - avatar