Here's my 2 cents worth...Actually I was bored and just wanted to code my own example. This code will check the board for the first set of 3 it finds. You could modify the function to keep checking for further results but this is just a simple example..
I strongly recommend making any algorithms like this one as a function. It will save you time in the future and makes for easier to read and debug code.
SeedRnd MilliSecs() Dim GameBoard%(9,9) ;Fill Board will Random Contents For x=0 To 9 For y=0 To 9 GameBoard%(x,y)=Rnd(1,8) Locate x*10,y*10 Print GameBoard%(x,y) Next Print Next Print Check3InRow%() While Not KeyHit(1) Wend End Function Check3InRow%() For Rows=0 To 7 For Cols=0 To 7 TargetVal%=GameBoard%(Cols,Rows) ;Check Horizontal If GameBoard%(Cols+1,Rows)=TargetVal Then If GameBoard%(Cols+2,Rows)=TargetVal Then Return TargetVal% EndIf EndIf ;Check Verticle If GameBoard%(Cols,Rows+1)=TargetVal Then If GameBoard%(Cols,Rows+2)=TargetVal Then Return TargetVal% EndIf EndIf Next Next Return -1 End Function
I strongly recommend making any algorithms like this one as a function. It will save you time in the future and makes for easier to read and debug code.