I have a list of strings:
['oXoXXoo', 'oXXoooo', 'oooXooo']
These are moves of a puzzle where one peg jumps over an adjacent peg. The first item in the list is the starting state and the final item is the solved board.
I am trying to display the moves needed to solve the board in the format:
[ (4, L), (1, R) ]
where peg at index [4] jumps left to get to the second board state and peg at index [1] jumps right to solve the puzzle. Basically I need to find specific differences between each list item and return a tuple list based on them. My current pseudocode idea is:
find where oXX became Xoo
path.add((index of the o+2, L))
find where XXo became ooX
path.add((index of the X+2, R))
I have also considered turning the strings into a list and doing something with .difference but im not sure where to go from there. Any suggests into how I can compare strings or lists in python welcome!