What i need to do is parse an integer to a "library" of co-ordinates. This integer allows for a random co-ordinate to be chosen. The "Library" i mentioned is shown below

    Public Function Hit(ByVal rnd As Integer)

        Select Case rnd
            case 0
                return "(0,0)"
            case 1
                return "(0,1)"
        End Select

    End Function

in total there are 99 different combinations of co-ordinates.

the return of this function needs to be recognised as an array item as shown below.

    If grid(xM, yM) = grid(*returned value*) Then
        grid(xM, yM) = 2
        grid(xM, yM) = 1
    End If

How can this be done?

I am either looking to convert the string "(0,0)" to grid(0,0) or can use another method to lookup the co-ordinates.

Thankyou in advance

6 Years
Discussion Span
Last Post by OblibSystems

Use a Point structure.

Public Function Hit(byval rnd as Integer) as Point
    return new Point(0,0)
End Function

Public Sub YourOtherCode
    Dim CheckPoint as Point = Hit(0)
    If grid(xM,yM) = grid(CheckPoint.X,CheckPoint.Y)
    End If
End Sub

You get it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.