# Regularity

Badness:

The goal: minimize the badness, defined as the sum of squares of difference between vertex valence and desired valence. The desired valence for boundary vertices is whatever they start at; for interior vertices it is 6. You can perform any of the following 3 operations repeatedly:

- Click on an edge and press 'f' to flip it.
- Click on an edge and press 'c' to collapse it. Not all edges are collapsable.
- Click on an edge and press 's' to split it.