nasty bug added

This commit is contained in:
tth
2022-02-08 02:53:49 +01:00
parent a693302969
commit d84c6d969c
10 changed files with 152 additions and 39 deletions

View File

@@ -21,7 +21,6 @@ module bloubspace
contains ! -----------------------------------------
subroutine random_pv (blb)
type(t_bloubs), intent (inout) :: blb
blb%px = rand() - 0.50
@@ -32,8 +31,29 @@ module bloubspace
blb%vy = (rand() - 0.5) / 4.000
blb%vz = (rand() - 0.5) / 4.000
end subroutine
blb%alive = .TRUE.
end subroutine
! ----------------------------------------------------------------
subroutine display_bloub (blb, message)
type(t_bloubs), intent (in) :: blb
character(*), intent (in) :: message
character(5) :: life
if (blb%alive) then
life = "alive"
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, '()')
end subroutine
! ----------------------------------------------------------------
subroutine move_bloub (blb, coef)
@@ -45,10 +65,52 @@ module bloubspace
blb%px = blb%px + (blb%vx * coef)
blb%py = blb%py + (blb%vy * coef)
blb%pz = blb%pz + (blb%vz * coef)
blb%seq = blb%seq + 1
end subroutine
! ----------------------------------------------------------------
subroutine bound_a_blob (blb)
type(t_bloubs), intent (inout) :: blb
if (5.0 .lt. blb%px) then
blb%vx = -1.0 * blb%vx
blb%px = 5.0
blb%seq = blb%seq + 1
endif
if (-5.0 .gt. blb%px) then
blb%vx = -1.0 * blb%vx
blb%px = -5.0
blb%seq = blb%seq + 1
endif
if (0.0 .gt. blb%py) then
blb%vy = -1.0 * blb%vy
blb%py = 0.0
endif
if (3.0 .lt. blb%py) then
blb%vy = -1.0 * blb%vy
blb%py = 3.0
endif
if (5.0 .lt. blb%pz) then
blb%vz = -1.0 * blb%vz
blb%pz = 5.0
endif
if (-5.0 .gt. blb%pz) then
blb%vz = -1.0 * blb%vz
blb%pz = -5.0
endif
end subroutine
! ----------------------------------------------------------------
subroutine green_soylent (blb)
type(t_bloubs), intent (inout) :: blb
if (blb%seq .gt. 200) then
blb%alive = .FALSE.
endif
end subroutine
! ----------------------------------------------------------------
end module