I'm doing a project for the purpose of learning more about abstraction in CS. I created a project in MIT-scratch in which four characters must have unique paths on a simple map, and not collide or pass through each other. I also want the paths to be somewhat complicated, otherwise, I could just make them all go in a circle.
To solve this problem with abstraction, I marked each of the nine possible locations on the map with a number, and control each character's path with an array which contains what map number it should be on at each interval of the cycle clock.
Using this program and some paper, I was able to find several rules for the arrays which if followed, should solve the original problem.
each next item in an array must be a neighbor to the previous one, including the first and last numbers in the array, to create a complete loop.
(1,2,5,4)
OK✱two arrays cannot have the same number at the same location.
(1,2) (3,2)
not OKtwo arrays cannot have a reciprocal pair at the same location.
(4,5) (5,4)
not OK
My question is, how would I go about creating a program that would show me all possible solution paths based on paths that I input? It could be a python program which outputs array/s, or I could create it in the scratch program along with some kind of graphical path creator. Any help is appreciated, I have no idea how to go about this.
✱ There's a bit of a complication, too. In the map, 1 and 4 are neighbors, but the abstraction, they are not. This could possibly be solved using some kind of function with a list of which numbers are neighbors.
Here's the scratch project if it's helpful: https://scratch.mit.edu/projects/321905242/