added winning condition (and tests); used 64-bit bit counting instead of 8-bit