Degenerate Conic

Algorithms • Modern Fortran Programming • Orbital Mechanics

Dec 25, 2014

Merry Christmas

program main

implicit none

integer :: i,j,nstar,nspace,ir  
character(len=:),allocatable :: stars,spaces

integer,parameter :: n = 10  
integer,parameter :: total = 1 + (n-1)*2

do j=1,200  
    call system('clear')  
    nstar = -1  
    do i=1,n  
        nstar = nstar + 2  
        nspace = (total - nstar)/2  
        stars = repeat('*',nstar)  
        spaces = repeat(' ',nspace)  
        if (i>1) then  
            ir = max(1,ceiling(rand(0)*len(stars)))  
            stars(ir:ir) = ' '  
        end if  
        write(*,'(A)') spaces//stars//spaces  
    end do  
    spaces = repeat(' ',(total-1)/2)  
    write(*,'(A)') spaces//'*'//spaces  
    write(*,'(A)') ''  
end do

end program main