add randomwalk next gen
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,4 +13,5 @@ oscilloscope
|
|||||||
lissajous
|
lissajous
|
||||||
squarmania
|
squarmania
|
||||||
testbed
|
testbed
|
||||||
|
rndwlkng
|
||||||
|
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -12,6 +12,11 @@ testbed: testbed.f90 Makefile genplotting.o
|
|||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
rndwlkng: rndwlkng.f90 Makefile genplotting.o
|
||||||
|
gfortran -Wall $< genplotting.o -o $@
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
starfield: starfield.f90 Makefile genplotting.o
|
starfield: starfield.f90 Makefile genplotting.o
|
||||||
gfortran -Wall $< genplotting.o -o $@
|
gfortran -Wall $< genplotting.o -o $@
|
||||||
|
|
||||||
|
|||||||
67
rndwlkng.f90
Normal file
67
rndwlkng.f90
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
!
|
||||||
|
! 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
|
||||||
|
! ---------------------------------------------------------
|
||||||
Reference in New Issue
Block a user