Program to calculate and log plot a "bell" curve

for the elements on level 74 of Pascal's Tetrahedron

! - - - - - - - - - - - - - - ! BELL-LOG.TRU Program
! - - - - - - - - - - - - - - ! to Calculate & Plot any Level
! - - - - - - - - - - - - - - ! of Pascal's Tetrahedron
! - - - - - - - - - - - - - - ! written: August, 1987
! - - - - - - - - - - - - - - ! revised: February 3, 1988 for Log Plot
! - - - - - - - - - - - - - - !      by: Jim Nugent
! - - - - - - - - - - - - - - !      at: Peoria, Illinois
! - - - - - - - - - - - - - - ! Initialization
SET MODE "vga"
CLEAR
LIBRARY "3dlib.trc"
LET flag = 0
LET hue = 8
DIM  pts(1 to 4050,0 TO 3)
DIM fred(0 to 75,0 to 75)
SET BACK 1
SET COLOR 12
PRINT "Log Plot - Pascal's Tet"

FOR level = 14 to 74 step 10
    MAT fred = zer
    MAT pts = zer
    LET hue = hue + 1
    LET dit=1
    LET index = level
    LET maxcol=index
    LET work$=""
    ! - - - - - - - - - - - - - - ! Main Program
    FOR row = 1 to index + 1
        FOR col = 1 to ((index + 2)  - row)
            IF row = 1 and col = 1 then
               LET fred(1,1) = 1
            ELSE IF row = 1 and col > 1 then
               LET fred(row,col) = (fred(row,(col-1)))*(((index+1)-(col-1))/(Col-1))
            ELSE IF row > 1 and col=1  then      ! pick off first columns in each row
               LET fred(row,col)=fred(col,row)
            ELSE                  ! rest of fred
               LET fred(row,col)=(fred(row,(col-1)))*(level+3-(col+row))/(col-1)
            END IF

            LET z = log10(fred(row,col))
            LET pts(dit,0) = row
            LET pts(dit,1) = col
            LET pts(dit,2) = z
            LET pts(dit,3) = 1
            LET dit = dit + 1

        NEXT col
        LET maxcol=maxcol - 1
        LET pts(dit-1,3) = 0
    NEXT row

    ! - - - - - - - - - - - - - - ! Print out of Array
       CALL scaleperswindow(1,45,1,45,1,20)
    IF flag = 0 then
       SET COLOR 7
!       CALL gridx3(1,1,75,1,30,15,15)
       CALL gridz3(0,0,75,0,75,15,15)
       CALL lineoff3(15,0,0,0,15,0)
       CALL lineoff3(30,0,0,0,30,0)
       CALL lineoff3(45,0,0,0,45,0)
       CALL lineoff3(60,0,0,0,60,0)
       CALL lineoff3(75,0,0,0,75,0)
       SET COLOR 7
!               ! the next lines are an attempt to blot out
!               ! grid beyond triangle
!       SET WINDOW 0,640,0,350
!       plot lines:489,0;346,350;640,350;640,0;489,0
!       FLOOD 630,330
       LET flag = 1
    ELSE
       LET flag = 1
    END IF
    SET COLOR hue
    CALL matplot3(pts(,))
    ! - - - - - - - - - - - - - - !
NEXT level
STOP
END
! - - - - - - - - - - - - - - !
! - - - - - - - - - - - - - - !