Sub haswon(board As Long) As Boolean
Dim y As Long = And64Bits(board, board / 2)
If And64Bits(y, y / 4) <> 0 Then Return True
For j = 6 To 8
y = And64Bits(board, board / Power(2, j))
If And64Bits(y, y / Power(2, 2 * j)) <> 0 Then Return True
Next
Return False
End Sub
Sub And64Bits(a As Long, b As Long) As Long
Dim c As Long = Bit.And(Bit.And(a / Power(2, 48), 65535), Bit.And(b / Power(2, 48), 65535))
For j = 1 To 3
a = a * 65536
b = b * 65536
c = c * 65536 + Bit.And(Bit.And(a / Power(2, 48), 65535), Bit.And(b / Power(2, 48), 65535))
Next
Return c
End Sub