For a more traditional way of doing this with a genetic algorithm instead (not AI written project) https://github.com/KodeMunkie/shapesnap
Full disclosure, that's my repo, forked and improved on an abandoned original.