Program to calculate and plot mod values

for the elements on a selected level of Pascal's Tetrahedron

 

! - - - - - - - - - - - - - - ! MOD-PLOT.TRU Program
! - - - - - - - - - - - - - - ! to Calculate & Plot even multiples in
! - - - - - - - - - - - - - - ! Pascal's Tetrahedron
! - - - - - - - - - - - - - - ! written: August 1987
! - - - - - - - - - - - - - - ! revised: January 26, 1988
! - - - - - - - - - - - - - - ! revised: 12/88 EGA - 2/89 VGA
! - - - - - - - - - - - - - - !      by: Jim Nugent
! - - - - - - - - - - - - - - !      at: Peoria, Illinois
! - - - - - - - - - - - - - - ! Initialization

DECLARE DEF in$,prod$,prod2$,quot$,quot2$,int$,mod$,zero$,one$,two$
library "d:\true\lib\hugelib.trc"
SET MODE "vga"
SET BACK 0
DIM pt$(128,128)
LET pad$ = repeat$(" ",30)
DO
   CLEAR
   SET COLOR 14
   PRINT pad$;"         enter zero to exit"
   INPUT prompt pad$&"     Level of Tetrahedron to plot? ":level
   INPUT prompt pad$&"                          modulus? ":multiple$
   IF level = 0 or multiple$="0" then EXIT DO
   LET mult$=in$(multiple$)
   CLEAR
   SET COLOR 15
   SET CURSOR 19,1
   PRINT pad$&"          Level =";level
   PRINT pad$&"          Modulus = "&multiple$
   SET COLOR 12
   PRINT pad$;"   EVEN MULTIPLE OF MODULUS"
   SET COLOR 10
   PRINT pad$;"        NOT A MULTIPLE"
   SET CURSOR 25,79
   LET index = level
   ! - - - - - - - - - - - - - - ! Main Program
   FOR row = 1 to index + 1

       FOR col = 1 to ((index + 2)  - row)

           IF row = 1 and col = 1 then
              LET pt$(1,1) = one$
           ELSE IF row = 1 and col > 1 then
              LET ratio1=(index+1)-(col-1)

              LET temp1$ = prod2$(pt$(row,(col-1)),ratio1)
              LET pt$(row,col) = int$(quot2$(temp1$,(col-1)))

           ELSE IF row > 1 and col=1  then  ! first column in each row
              LET pt$(row,col)=pt$(col,row)
           ELSE                   ! rest of points
              LET ratio2=(level+3-(col+row))
              LET temp2$=prod2$(pt$(row,(col-1)),ratio2)
              LET pt$(row,col)=int$(quot2$(temp2$,(col-1)))
           END IF

       NEXT col
   NEXT row

   ! - - - - - - - - - - - - - - ! Print out of Array

   SET WINDOW 0, level*2, 0 , level+2
   FOR row = 1 to index + 1
       ! print " "

       LET offset=.5*row
       FOR col = 1 to ((index + 2)  - row)
           !print " "
           IF mod$(pt$(row,col),mult$)=zero$ then
              SET COLOR 12
              BOX CIRCLE row-.3,row+.3,offset+col-.3,offset+col+.3
              FLOOD row,offset+col
           ELSE
              SET COLOR 10
              BOX CIRCLE row-.3,row+.3,offset+col-.3,offset+col+.3
              FLOOD row,offset+col
           END IF
           !        PRINT outd$(pt$(row,col),0)
       NEXT col
   NEXT row
get key fred
LOOP
! - - - - - - - - - - - - - - !
set mode "history"
END
! - - - - - - - - - - - - - - !
! - - - - - - - - - - - - - - !