DECLARE DEF outd$,in$,prod$,prod2$,quot$,quot2$,int$,mod$,zero$,one$,two$,out$
LIBRARY "d:\true\math\hugelib"
SET MODE "vga"
SET BACK 1
DIM first_row$(15000)
DIM pt$(15000)
LET pad$ = repeat$(" ",30)
CLEAR
SET COLOR 14
PRINT
PRINT "
LEV-ANY PROGRAM - Calculates Pascal's Tet Values"
PRINT "
Copyright 1990 by Jim Nugent, Peoria, Illinois"
PRINT
INPUT PROMPT " Send to printer? (y or n):":p$
DO
CLEAR
PRINT "
enter zero to exit"
INPUT prompt "
Level ( 1 to 15,000 ) to print? ":level
IF level = 0 then EXIT DO
CLEAR
SET CURSOR 3,1
PRINT pad$ & " Level = ";level
PRINT " "
IF p$ = "y" or p$ = "Y" THEN
OPEN #16:printer
PRINT #16: time$,date$,"START
OF LEVEL = ";level
ELSE
OPEN #16:screen 0,1,0,1
set back 1
set color 15
END IF
LET start$=time$
LET index = level
LET rty$ = " #### ####
#### "
! - - - - - - - - - - - - - - ! Main
Program
FOR row = 1 to index + 1
PRINT #16: "
ROW COLUMN DIGITS
VALUE OF ELEMENTS FOR ROW ";row
FOR col = 1
to ((index + 2) - row)
IF row = 1 and col = 1 then
LET first_row$(1) = one$
ELSE IF row = 1 and col > 1 then
LET ratio1=(index+1)-(col-1)
LET temp1$ = prod2$(first_row$(col-1),ratio1)
LET first_row$(col) = int$(quot2$(temp1$,(col-1)))
ELSE IF row > 1 and col=1 then ! first column in each row
LET pt$(col)=first_row$(row)
ELSE
! rest of points
LET ratio2=(level+3-(col+row))
LET temp2$=prod2$(pt$(col-1),ratio2)
LET pt$(col)=int$(quot2$(temp2$,(col-1)))
END IF
! ! P R I N T E L E M E N T
IF row = 1 then
LET pt$(col) = first_row$(col)
END IF
! !
LET squished$ = outd$(pt$(col),0)
LET places = LEN(squished$)
PRINT #16, using rty$: row,col,places;
CALL DIVIDE(places,50,fifty_blocks,mander)
LET squished$ = repeat$(" ",50-mander)&squished$
FOR blocks = 0 to fifty_blocks
LET fifty$ = squished$[(blocks*50)+1:(blocks*50)+50]
IF blocks > 0 then
PRINT #16:repeat$(" ",20);
END IF
FOR tener = 0 to 3
PRINT #16: fifty$[(tener*10)+1:(tener*10)+10];" ";
NEXT tener
PRINT #16: fifty$[(tener*10)+1:(tener*10)+10];" "
NEXT blocks
NEXT col
NEXT row
PRINT #16: "start =";start$;" end =
";time$,date$,"END OF LEVEL = ";level
PRINT
CLOSE #16
! !
GET KEY fred
LOOP
! - - - - - - - - - - - - - - !
set back 1
set color 15
clear
print "goodbye"
SET MODE "history"
END
! - - - - - - - - - - - - - - !