Click to See Complete Forum and Search --> : random Walker
AndreasV
Jan 9th, 2001, 02:34 PM
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!
[Digital-X-Treme]
Jan 9th, 2001, 02:49 PM
Could you explain what you want in more detail? I dont understand what you mean by "non-reverse random walker"...;)
AndreasV
Jan 10th, 2001, 02:36 PM
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!
marnitzg
Jan 11th, 2001, 02:23 PM
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
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.
Balder
Jan 15th, 2001, 06:29 AM
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. :cool:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.