performance optimization: precalculate cache and valence score tables
performance optimization: do not search for the best, but for any unused triangle. Also makes the algorithm O(n) again instead of O(n^2)  in the worst case.