= True
End If
Next i
If Not blnPCWellsExists Then
GoTo GetPCFirstWells:
Else
GoTo GetPCNextWells:
End If
GetPCFirstWells: ''随机获得机器的第一个落子位置
intPCFirstWells = Int((9 - 1 + 1) * Rnd + 1)
If usrWells(intPCFirstWells).Wells_Value <> 0 Then
GoTo GetPCFirstWells:
Else
intPCWells = intPCFirstWells
End If
GoTo GoOn:
GetPCNextWells: ''获得机器下一步的落子位置
intPCWells = funGetPCWells
GoOn: ''绘制落子并判断胜利
usrWells(intPCWells).Wells_Value = -1
lngGetWells_X = usrWells(intPCWells).Wells_X
lngGetWells_Y = usrWells(intPCWells).Wells_Y
Me.picWells.PaintPicture Me.imgChequer(COMPUTER).Picture, lngGetWells_X, lngGetWells_Y, _
Me.picWells.Width / 3, Me.picWells.Height / 3
If funPlayerWinIF(COMPUTER) Then
Beep
MsgBox "抱歉,您失败了!", , "BS井字游戏"
lngPlayerScore = lngPlayerScore - 100
If lngPlayerScore < 0 Then lngPlayerScore = 0
Call subScreenRefresh
blnGameStart = False
Else
blnPlayerTurn = True
End If
End Sub
''该自定义函数用于判断玩家是否胜利
Private Function funPlayerWinIF(PlayerType As Integer) As Boolean
Dim intWinCase(1 To 8) As Integer
intWinCase(1) = usrWells(1).Wells_Value + usrWells(2).Wells_Value + usrWells(3).Wells_Value
intWinCase(2) = usrWells(4).Wells_Value + usrWells(5).Wells_Value + usrWells(6).Wells_Value
intWinCase(3) = usrWells(7).Wells_Value + usrWells(8).Wells_Value + usrWells(9).Wells_Value
intWinCase(4) = usrWells(1).Wells_Value + usrWells(4).Wells_Value + usrWells(7).