At its core, a tree algorithm like the image above is what makes contra dance generation an elegantly solveable problem for a machine.
In less distressing news, today I built out my algorithm model! Only about 70% of it is in Python (the rest is pseudocode comments and queries to the as-yet-unpopulated database), but the logic feels solid and I should be able to get it up and running on a limited data set tomorrow.
I also spent some time reading through the theory behind constraint satisfaction problems. This dance generator is a straightforward example of constraint satisfaction in action:
the timing of a single move cannot cross between 16-beat phrases of music
each move must flow from one to the next; it is physically impossible* for dancers to seamlessly follow a neighbor balance with a partner swing
a dance must contain at least one progression to the next couple
I’ll also be adding some less crucial heuristics to the algorithm to ensure that it produces “worthwhile” dances. While hilarious in theory, a dance containing six petronella twirls would not be very fun.
Common real-life problems that can be modeled as constraint satisfaction problems include scheduling, sudoku puzzles, and resource allocation.
Tomorrow, if I have the time, I’ll do some more research into the mathematical and programming theory behind constraint satisfaction. I probably already know everything I need to implement the dance generator, so this will mostly be for fun/to solidify the concepts in my brain. Hooray P vs NP!
* By physically impossible, I mean that any caller who tried to get dancers to do it would be shouted out of the dance.