This is not my problem... someone I know is having this problem..


----------

I'm working on a visual basic project for one of my classes and, despite having all the code written, I'm having a minor problem. The program is a connect 4 game, and the problem is that it thinks every click is a winning move. I stepped through the whole program and can't find what's wrong with it; I spent a while in the prof's office and his answer was basically that he doesn't know what the problem is and can't find it either. So i present it to you in hopes that you would be willing to help me find the errors of my ways. By the way, most of the code comes from his hand out on the subject. Please know that I wouldn't have written it this way; I simply followed his directions. The code is avalible here http://unixweb.kutztown.edu/~benn2517/ConnectFour.zip
and here is what I think is the important part. Thanks for looking
Private Sub MakeMove()
' Is column full??
Dim r As Integer
Dim c As Integer
r = fgdBoard.Row
c = fgdBoard.Col

If ColumnStatus(c) > 0 Then
ColumnStatus(c) = ColumnStatus(c) - 1
fgdBoard.Row = ColumnStatus(c)
fgdBoard.CellBackColor = color(whoseTurn)
board(r, c) = whoseTurn
fgdBoard.text = text(whoseTurn)
If CheckIfWon(r, c) = True Then
Dim dummy As Integer
dummy = MsgBox("Player " + Str(whoseTurn) + " won the game!", vbExclamation, "Winner!!")
frmPrompt.Show vbModal
Call startOver
End If
Else
Dim otherDummy As Integer
otherDummy = MsgBox("Error - that column is full. Try again", vbExclamation, "Column Full!!")
End If

End Sub

Private Function CheckIfWon(r As Integer, c As Integer) As Boolean
Dim curSum As Integer

curSum = CheckLine(curSum, r, c, 0, -1)
Debug.Print "cursum 1 is " & curSum
curSum = CheckLine(curSum, r, c, 0, 1)
Debug.Print "cursum 2 is " & curSum

If curSum < 4 Then
curSum = 0
curSum = CheckLine(curSum, r, c, -1, 0)
If curSum < 4 Then
curSum = 0
curSum = CheckLine(curSum, r, c, -1, 1)
curSum = CheckLine(curSum, r, c, 1, -1)
If curSum < 4 Then
curSum = 0
curSum = CheckLine(curSum, r, c, -1, -1)
curSum = CheckLine(curSum, r, c, 1, 1)
If curSum < 4 Then
CheckIfWon = True
Else
CheckIfWon = False
End If
Else
CheckIfWon = True
End If
Else
CheckIfWon = False
End If
Else
CheckIfWon = False
End If
End Function

Private Function CheckLine(curSum As Integer, curRow As Integer, curCol As Integer, addRow As Integer, addCol As Integer) As Integer

If curRow < 0 Or curRow > BOARDHEIGHT Or curCol < 0 Or curCol > BOARDHEIGHT Then
CheckLine = curSum
Else
If Not board(curRow, curCol) = whoseTurn Then
CheckLine = curSum
Else
curSum = CheckLine(curSum + 1, curRow + addRow, curCol + addCol, addRow, addCol)
CheckLine = curSum
End If
End If
End Function

------