|
原XQWLight模块中的以下两个过程代码增加为:
Public Function AddMove(ByVal mv As Long) As Boolean
Dim i As Long '后加
For i = 1 To 256
arr0(i) = arr(i)
Next i
For i = 1 To 17
arr2(i) = arr22(i)
arr3(i) = arr33(i)
arr4(i) = arr44(i)
arr5(i) = arr55(i)
Next i '以上两个For循环为后加,以获取每步人手移前的棋盘数据,该数据实际上为前一步(回合)电脑回应后的数据
v = vv '后加
Dim sqSrc As Long, sqDst As Long
If Search_pos.LegalMove(mv) Then
sqSrc = SRC(mv)
sqDst = DST(mv)
If Search_pos.MakeMove(mv) Then
PlaySound (IIF_STR(Search_pos.InCheck, "CHECK", IIF_STR(Search_pos.Captured, "CAPTURE", "MOVE")))
If Search_pos.Captured Then
Search_pos.SetIrrev
End If
App_sqSelected = 0
App_mvLast = mv
Application.ScreenUpdating = False
App_frm.DrawSquare sqSrc, DRAW_SELECTED
App_frm.DrawSquare sqDst, DRAW_SELECTED
Application.ScreenUpdating = True
AddMove = True
Exit Function
Else
PlaySound ("ILLEGAL")
End If
End If
AddMove = False
End Function
......
Public Function ResponseMove() As Boolean
'If HuiQiYiShou = True Then HuiQiYiShou = False: Exit Function
Dim sqSrc As Long, sqDst As Long, szWavFile As String
If GetResult() Then
ResponseMove = False
Exit Function
End If
sqSrc = SRC(App_mvLast)
sqDst = DST(App_mvLast)
With App_frm.Pictures("imgThinking")
.Left = App_frm.PlotArea.InsideLeft + (App_frm.PlotArea.InsideWidth - .Width) / 2 'LEFT_MARGIN + IIF_INT(FILE_X(sqDst) < 8 Xor App_bFlipped, 112, 0)
.Top = App_frm.PlotArea.InsideTop + (App_frm.PlotArea.InsideHeight - .Height) / 2 'TOP_MARGIN + IIF_INT(RANK_Y(sqDst) < 8 Xor App_bFlipped, 128, 0)
.Visible = True
End With
App_frm.Refresh
SearchMain (CLng(4 ^ App_nLevel))
App_frm.Pictures("imgThinking").Visible = False
Application.ScreenUpdating = False
If App_mvLast > 0 Then
App_frm.DrawSquare (sqSrc)
App_frm.DrawSquare (sqDst)
End If
Search_pos.MakeMove (Search_mvResult)
szWavFile = IIF_STR(Search_pos.InCheck, "CHECK2", IIF_STR(Search_pos.Captured, "CAPTURE2", "MOVE2"))
If Search_pos.Captured Then
Search_pos.SetIrrev
End If
App_mvLast = Search_mvResult
App_frm.DrawSquare SRC(App_mvLast), DRAW_SELECTED
App_frm.DrawSquare DST(App_mvLast), DRAW_SELECTED
Application.ScreenUpdating = True
If GetResult(szWavFile) Then
ResponseMove = False
Exit Function
End If
ResponseMove = True
Dim i As Long '后加
For i = 1 To 256
arr(i) = Sheet1.Range("B" & i).Value
Next i
For i = 1 To 17
arr22(i) = Sheet1.Range("Q" & i).Value
arr33(i) = Sheet1.Range("R" & i).Value
arr44(i) = Sheet1.Range("U" & i).Value
arr55(i) = Sheet1.Range("V" & i).Value
Next i '以上两个For循环为后加,以获取每步电脑回应后的棋盘数据,该数据实际上为前一步(回合)人手移前的数据
vv = ThisWorkbook.Worksheets("Data").Names("选中").RefersToRange.Value '后加
End Function
|
|