Algorithm is starting to take shape. The AI can start a game or the user can start it.
Finished the algorithm, it seems to work fairly well from my tests.