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

Recommended Answers

All 2 Replies

Member Avatar for Unhnd_Exception

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.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.