some adjustements, but need more work
This commit is contained in:
24
rndwlkng.f90
24
rndwlkng.f90
@@ -11,27 +11,24 @@ program rndwlkng
|
|||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
type walker
|
type walker
|
||||||
real :: xloc, yloc
|
real :: xloc, yloc ! where I am ?
|
||||||
real :: heading ! direction in degrees
|
real :: heading ! direction in degrees
|
||||||
real :: powa
|
real :: powa ! correlated to nothing
|
||||||
end type walker
|
end type walker
|
||||||
|
|
||||||
type (walker) drunky
|
type (walker) drunky
|
||||||
integer pass
|
integer pass
|
||||||
|
|
||||||
drunky%xloc = 0.00
|
call srand(time())
|
||||||
drunky%yloc = 0.00
|
|
||||||
drunky%heading = 13.37
|
|
||||||
drunky%powa = 4.00
|
|
||||||
|
|
||||||
call genp_init(0, "WS/rndwlkng.scratch")
|
call genp_init(0, "WS/rndwlkng.scratch")
|
||||||
|
|
||||||
do pass=1, 100
|
do pass=1, 73
|
||||||
drunky%xloc = 5555 * (rand(0) - 0.50)
|
drunky%xloc = 5555 * (rand(0) - 0.50)
|
||||||
drunky%yloc = 5555 * (rand(0) - 0.50)
|
drunky%yloc = 5555 * (rand(0) - 0.50)
|
||||||
drunky%heading = 13.37
|
drunky%heading = 360 * rand(0)
|
||||||
drunky%powa = 4.00
|
drunky%powa = 6.00
|
||||||
call move_the_walker(drunky, 1000, mod(pass, 5)+1)
|
call move_the_walker(drunky, 700, mod(pass, 6)+1)
|
||||||
end do
|
end do
|
||||||
|
|
||||||
call genp_end(0)
|
call genp_end(0)
|
||||||
@@ -47,18 +44,15 @@ subroutine move_the_walker(bob, nbmove, col)
|
|||||||
real :: rad, mv, dx, dy
|
real :: rad, mv, dx, dy
|
||||||
|
|
||||||
call genp_move(bob%xloc, bob%yloc)
|
call genp_move(bob%xloc, bob%yloc)
|
||||||
|
|
||||||
do idx=1, nbmove
|
do idx=1, nbmove
|
||||||
rad = ( 3.141592654 * bob%heading ) / 180.0
|
rad = ( 3.141592654 * bob%heading ) / 180.0
|
||||||
mv = 0.5 + (bob%powa * rand(0))
|
mv = 1.555 + (bob%powa * rand(0))
|
||||||
dx = mv * sin(rad)
|
dx = mv * sin(rad)
|
||||||
dy = mv * cos(rad)
|
dy = mv * cos(rad)
|
||||||
bob%xloc = bob%xloc + dx
|
bob%xloc = bob%xloc + dx
|
||||||
bob%yloc = bob%yloc + dy
|
bob%yloc = bob%yloc + dy
|
||||||
bob%heading = bob%heading + 33 * (rand(0) - 0.50000)
|
bob%heading = bob%heading + 42.42 * (rand(0) - 0.50000)
|
||||||
|
|
||||||
call genp_draw(bob%xloc, bob%yloc, col)
|
call genp_draw(bob%xloc, bob%yloc, col)
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|||||||
Reference in New Issue
Block a user