I just tracked down the cause of this bug in my code: every so often the checkerboard was flipping 180 degrees between l