Im writing a Network version of Othello (sometimes called Reversi)
but im having trouble with the function that checks your move.
A screen shot of my app:
Basically each Square is a PictureBox, Player 1 (White) goes first, so if for example they click the picturebox (F,5) which incidentally is named "F5" i want it to pass the name F5 to my checking Function (which isnt complete because i couldnt get the first few lines of code to execute). The checking function needs to first check if the box above it is Black, then if it is it needs to go to the square above and check if it's black (it continues to do this untill A it reaches the last square or it runs into B a blank square (in this case it needs to check the diagonal(s)) or C a White square (where it then needs to "flip" all the squares in between and then continue to check the diagonals)).
Here is My code for the box F5:
Private Sub F5_Click() If HostTurn = True Then CheckPossibilities "F5" End Sub
Here is my function code:
Function CheckPossibilities(Square As String) Dim Num As Integer Dim Square2 As PictureBox Num = Right$(Square, 1) If Num >= 2 Then Num = Num - 1 If HostTurn Then Square2 = Left$(Square, 1) & Num 'This is the Problem Line! If Square2.Picture = White.Picture Then 'This is the white "control" picture Goto APieceOfCodeNotYetWritten Else If Num >= 2 Then Num = Num - 1 Square2 = Left$(Square, 1) & Num if Square2.Picture = White.Picture Then Goto APieceOfCodeNotYetWritten End If End If End If End If End If End Function
The Problem line: Square2 = Left$(Square, 1) & Num
The error message i get is: [img]http://homepages.picknowl.com.au/craig_sharon/error.jpg[/img]
Basically i need to know how i can do this ^ so that i can use variables to go through each square and test it before sending the "updated" square values to the other player
If you have any questions please post them, i really want this to work and any help i receive will be greatly appreciated.