new Tri class, added flip function and test