subroutine green_soylent in actio

This commit is contained in:
tth
2022-02-08 18:56:51 +01:00
parent 6094e29efd
commit c35c00e3da
9 changed files with 88 additions and 53 deletions

View File

@@ -23,13 +23,13 @@ module bloubspace
subroutine random_pv (blb)
type(t_bloubs), intent (inout) :: blb
blb%px = rand() - 0.50
blb%py = rand() * 0.25
blb%pz = rand() - 0.50
blb%px = 2.0 * (rand() - 0.50)
blb%py = rand() * 0.50
blb%pz = 2.0 * (rand() - 0.50)
blb%vx = (rand() - 0.5) / 4.000
blb%vy = (rand() - 0.5) / 4.000
blb%vz = (rand() - 0.5) / 4.000
blb%vx = (rand() - 0.5) / 3.000
blb%vy = (rand() - 0.5) / 3.000
blb%vz = (rand() - 0.5) / 3.000
blb%alive = .TRUE.
@@ -47,10 +47,10 @@ module bloubspace
else
life = "dead"
endif
write (0, '(A)') '------------- ' // message
write (0, '(4X,A8,2X,I6,4X,A5)') blb%nick, blb%num, blb%alive
write (0, '(4X,A1,3X,3(F8.3, 4X))') 'P', blb%px, blb%py, blb%pz
write (0, '(4X,A1,3X,3(F8.3, 4X))') 'V', blb%vx, blb%vy, blb%vz
write (0, '(4X, A)') '+------------ ' // message
write (0, '(4X,A3,A8,2X,I6,4X,A5)') '| ', blb%nick, blb%num, life
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| P', blb%px, blb%py, blb%pz
write (0, '(4X,A3,3X,3(F8.3, 4X))') '| V', blb%vx, blb%vy, blb%vz
write (0, '()')
end subroutine
@@ -85,18 +85,22 @@ module bloubspace
if (0.0 .gt. blb%py) then
blb%vy = -1.0 * blb%vy
blb%py = 0.0
blb%seq = blb%seq + 1
endif
if (3.0 .lt. blb%py) then
blb%vy = -1.0 * blb%vy
blb%seq = blb%seq + 1
blb%py = 3.0
endif
if (5.0 .lt. blb%pz) then
blb%vz = -1.0 * blb%vz
blb%seq = blb%seq + 1
blb%pz = 5.0
endif
if (-5.0 .gt. blb%pz) then
blb%vz = -1.0 * blb%vz
blb%seq = blb%seq + 1
blb%pz = -5.0
endif
@@ -105,7 +109,7 @@ module bloubspace
! ----------------------------------------------------------------
subroutine green_soylent (blb)
type(t_bloubs), intent (inout) :: blb
if (blb%seq .gt. 200) then
if (blb%seq .gt. 4) then
blb%alive = .FALSE.
endif
end subroutine