Files
GenPlotting90/rndwlkng.f90
2026-05-08 23:54:39 +02:00

68 lines
1.7 KiB
Fortran

!
! Random Walk Next Generation
! new Fri May 8 06:53:02 AM UTC 2026
!
! this crapware is released by tTh under the
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
!
! ---------------------------------------------------------
program rndwlkng
use genplotting
implicit none
type walker
real :: xloc, yloc
real :: heading ! direction in degrees
real :: powa
end type walker
type (walker) drunky
integer pass
drunky%xloc = 0.00
drunky%yloc = 0.00
drunky%heading = 13.37
drunky%powa = 4.00
call genp_init(0, "WS/rndwlkng.scratch")
do pass=1, 100
drunky%xloc = 5555 * (rand(0) - 0.50)
drunky%yloc = 5555 * (rand(0) - 0.50)
drunky%heading = 13.37
drunky%powa = 4.00
call move_the_walker(drunky, 1000, mod(pass, 5)+1)
end do
call genp_end(0)
call genp_do_render("WS/rndwlkng.scratch", "rndwlkng.tga", 512, 512)
contains
! ---------------------------------------------------------
subroutine move_the_walker(bob, nbmove, col)
type (walker), intent(inout) :: bob
integer, intent(in) :: nbmove, col
integer :: idx
real :: rad, mv, dx, dy
call genp_move(bob%xloc, bob%yloc)
do idx=1, nbmove
rad = ( 3.141592654 * bob%heading ) / 180.0
mv = 0.5 + (bob%powa * rand(0))
dx = mv * sin(rad)
dy = mv * cos(rad)
bob%xloc = bob%xloc + dx
bob%yloc = bob%yloc + dy
bob%heading = bob%heading + 33 * (rand(0) - 0.50000)
call genp_draw(bob%xloc, bob%yloc, col)
enddo
end subroutine
! ---------------------------------------------------------
end program
! ---------------------------------------------------------