I'm trying to make a board game in Python. However, I'm stuck with a portion of it.
For example:
If you have a list:
lst = [1, 2, 3, 4, 5, 6, 'E']
A player can roll 1-6 and can start at any position other than 'E' as that's the winning space. If the player is at index 3, or value 4, and rolls a 3 they land on the 'E' space and everything is fine. However, if they roll a 6 for instance, they would move 3 steps forward to the 'E' value and then 'bounce back' 3 spaces back to index 3 or value 4 for a total of 6 moves. If they start at index 5, and roll a 5 they would go back to index 2 for a total of 5 moves etc. I'm not sure how to implement something like this or if there would be a better way to structure this instead? Any help is appreciated.