Results 1 to 6 of 6

Thread: random Walker

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    2

    Smile

    Does somebody know a way to make a non-reverse random walker??? And fast too??

    AndreasV
    --
    PS-I have a algoritmh for converting any number in any system to anynumber in any system!
    Is Visual Basic, just Visual or Basic?

  2. #2
    Fanatic Member
    Join Date
    Sep 2000
    Location
    UK.
    Posts
    728

    Question Sorry, what?

    Could you explain what you want in more detail? I dont understand what you mean by "non-reverse random walker"...
    Digital-X-Treme
    Contact me on MSN Messenger: [email protected]

    [VBCODE]Debug.Print Round(((1097) - ((55 ^ 5 + 311 ^ 3 - 11 ^ 3) _
    / (68 ^ 5))) ^ (1 / 7), 13)[/VBCODE]

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2001
    Posts
    2
    A random walker puts on a point,randomly choosen, on the screen.
    The next point will be one step to the left, the right, up or down. This is the most simple randomwalker.
    You also have a random walker wich may not go back from where he came from. The one I am looking for is a randomwalker which may not visit any place he's been before. So the randomwalker could stop after some points, because he could be surrounded by other points.
    But the point is, how could you see if a point is already visited? I have tried it with an array, but it become way to long(over 10000*10000!). Is there any way to check if a point is checked?

    Andreas Verhoeven
    PS- email me for an simple randomwalk programm!
    Is Visual Basic, just Visual or Basic?

  4. #4
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372

    Haven't done any graphics before but ...

    When I wrote my snake program years back in pascal, I used a method called getpixelcolor. It just checks the color of the pixel to see if it is a certain color (the color of the snake/walker). Maybe you could use something similar to find out if it has moved over that area before. That way, you don't have to run through a huge array.

    I know there's a function like that in C, not to sure about VB

  5. #5
    Guest
    This scheme would limit the size of the potential walking
    block, but presumably you could extend the concept to
    hyperblocks.

    Given that you start at the center of a block you have the
    following situation:

    111
    101
    111

    Obviously, you can proceed in any of 8 directions.
    Consider that this can be represented by a string: 111101111

    If you extend the practice to a 175x175 block, you have a
    string of length 30625. Assume that your current position
    is X. Mark X as a 0. Then your next position could be
    determined by: CP: crow=(X mod 175) ccol=X-(175 * row)

    q=rnd(8);
    q<6: nrow=crow ncol=ccol + (1*(q=4)) + (-1*(q=5))
    q>5; nrow=crow+1 ncol=ccol + (q-7)
    q<4: nrow=crow-1 ncol=ccol + (q-2)

    NX = nrow*175 + ncol

    Build a function to return the possible, non-zero steps
    calculated from above using the mid$ function. When the
    function returns a null string (all possible positions have
    been seen) you are finished.

  6. #6
    Member
    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    37

    Another way...

    The complex value z=a+bi can in another form be written
    z=r(cos(alpha)-sin(alpha)
    where r=length of z vector and alpha=angle x-axis->z vector

    My thought is to create a unique value for each point the Walker enters and save theese values in a one-dimensional matrice. Every time we randomly create a new point we check towards this matrice too see if the new unique value already exist, in other words, too check if the new point has been entered before.

    Imagine the line between origo (0,0) and our point (x,y) in a coordinate system.
    The length of this line = sqrt(x^2+y^2)
    The angle between x-axis -> line is = arctan(y/x)

    Now let´s use the complex formula above to create a unique
    value for the point (x,y)

    NewPointVal=(sqrt(x^2+y^2)(sin(arctan(y/x)-sin(arctan(y/x))

    Check it against the matrice with all previous values saved in it. Remember to use a matice with decimals.

    Ok, this is a theory. Maybe it isn´t easier at all, and I hope I didn´t abuse the complex formula.
    But I honesly think it look nice mathematically.
    Balder = Viking God
    VB6/VC++ Enterprise Editions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width