Speed improvements

The sum function was taking the most time in the profile.  Replacing it with explicit sums saves a bunch of time.
Cache symmetries when winning or tying board is reached