Playing Back Images & Values
Calculating the values of the elements of Pascal's Tetrahedron can be time intensive
This program plays back screen images and value data from text files recorded earlier with the Record program
 

! - - - - - - - - - - - - - - ! PLAYIMAG.TRU
!                             ! programmed in True BASIC
!                             ! copyright by Jim Nugent, Peoria, Illinois
!                             ! September 7, 1989
!                             ! adapted from plaimage.tru a screen playback
!                             ! program
!                             ! use after making data files with
!                             ! RECIMAGE.TRU
!                             ! 3/4/90 horizontal output, drive & level prompt
! - - - - - - - - - - - - - - !
SET MODE "VGA"
SET BACK 1
SET COLOR 14
CLEAR
OPEN #7:screen .1,.9,.3,.8
PRINT #7:"     PLAIMAGE plays back images previously calculated "
PRINT #7:"       and saved with RECIMAGE.EXE.  These `slices' "
PRINT #7:"                can take hours to generate.    "
PRINT #7:"                 28:00:00 for level 100"
PRINT #7:"                  7:35:36 for level 75"
PRINT #7:"                  1:19:57 for level 50"
PRINT #7:"                  0:04:07 for level 25"
GET KEY jim
CLOSE #7
CLEAR
!- - - - - - - - - - - - - - ! tet-pic
WHEN ERROR IN
     OPEN #5: name "tetra.pic", org byte
     ASK #5:FILESIZE fs
     READ#5, bytes fs:keep$
     SET WINDOW 0,1,0,1

     BOX SHOW keep$  at .2,.2
     CLOSE #5

USE
     SET CURSOR 13,25
     PRINT "IMAGE FILE"
     SET CURSOR 14,25
     PRINT "TETRA .PIC"
     SET CURSOR 15,25
     PRINT "IS MISSING"
END WHEN
PLOT TEXT, AT .5,.75:"(0,0,0) - Level Zero"
PLOT TEXT, AT .6,.58:"(1,0,0) - Level One"
PLOT TEXT, AT .7,.4:"(2,0,0) - Level Two"
PLOT TEXT, AT .7,.2:"(3,0,0) - Level Three"
PLOT TEXT, AT .1,.18:"      (0,3,0)        (1,2,0)       (2,1,0)"
SET COLOR 15
PLOT TEXT, AT .1,.95:"Tetrahedral Lattice (cube-corner) with Selected"
PLOT TEXT, AT .1,.9:"(x,y,z)  Points and Levels (slices) Labeled "
GET KEY jim
CLEAR

SET COLOR 10
PRINT
SET CURSOR 10,10
PRINT "          Use the up and down arrow keys to go up or down one level "
PRINT "           at a time.  Left and right arrows change levels by ten. "
PRINT "                  Use the end key to stop the program "
PRINT " "
PRINT "          (c) Copyright 1989, by Jim Nugent, Peoria, Illinois "
PRINT
PRINT "                              a.  A:\"
PRINT "                              b.  A:\DATA\"
PRINT "                              c.  c:\true\levels\"
PRINT "                              d.  d:\true\levels\"
PRINT " "
INPUT PROMPT "      Enter a, b, c, d or drive & path where data is stored: ":drive$

IF drive$= "a" or drive$ = "A" THEN
   LET drive$ = "A:\"
ELSE IF drive$ = "b" or drive$ = "B" THEN
   LET drive$ = "A:\DATA\"
ELSE IF drive$ = "c" or drive$ = "C" THEN
   LET drive$ = "C:\true\levels\"
ELSE IF drive$ = "d" or drive$ = "D" THEN
   LET drive$ = "D:\true\levels\"
ELSE
   LET drive$ = drive$
END IF
PRINT " "
INPUT PROMPT "          Enter LEVEL    ":level
! INPUT PROMPT "          Enter overlay LEVEL    ":level2

IF level <3 then STOP
! - - - - - - - - - - - - - - ! open level file and get string$
CLEAR
DO
   LET level$=str$(level)
   OPEN #5: name drive$&"IMAGE"&level$&".txt", org byte
   ASK #5: FILESIZE fs
   READ #5, bytes fs: image$
   CLOSE #5
set mode "vga"
   OPEN #2:SCREEN 0,1,0,1
   LET index = level
   ! - - - - - - - - - - - - - - ! Print out of Array

   CLEAR
   SET WINDOW 0, level+2, 0 , level+1.5

   CALL BEGIN_POSTSCRIPT("LEV"&LEVEL$&".EPS",36,546,36,409.5)
   CALL ADD_POSTSCRIPT("")
   CALL ADD_POSTSCRIPT("% COPYRIGHT 1993 BY JIM NUGENT, PEORIA, IL")
   CALL ADD_POSTSCRIPT("")

   SET COLOR MIX(4)1,0,0          !red
   SET COLOR MIX(2)0,1,0          !green
   SET COLOR MIX(1)0,0,1          !blue
   SET COLOR MIX(7)1,1,1          !white

   LET vf = .45                   !
   LET vcf = .4                   !
   LET x = 1
   FOR row = 1 to index + 1
       FOR col = 1 to ((index + 2)  - row)
           LET offset=.5*(row-1)
           LET diskimage$=image$[x:x]
           LET x = x + 1
           IF diskimage$="B"  THEN     ! flood both with red
              SET COLOR 4         ! 4 is red
              BOX CIRCLE offset+col-vcf,offset+col+vcf,row-vf,row+vf
              !              FLOOD offset+col,row

           ELSE IF diskimage$="P" then      ! mark plus_one with green
              SET COLOR 2         ! 2 is green
              BOX CIRCLE offset+col-vcf,offset+col+vcf,row-vf,row+vf
              !              FLOOD offset+col,row

           ELSE IF diskimage$="M"then  ! mark minus one primes
              SET COLOR 1         ! 1 is blue
              BOX CIRCLE offset+col-vcf,offset+col+vcf,row-vf,row+vf
              !              FLOOD offset+col,row

           ELSE IF diskimage$="N" then      ! mark no adj. primes white
              SET COLOR 7         ! 7 is white 0 is black

              BOX CIRCLE offset+col-vcf,offset+col+vcf,row-vf,row+vf
              !              FLOOD offset+col,row

           END IF
           LET diskimage$=""
       NEXT col
   NEXT row
   LET image$=""
   CALL END_POSTSCRIPT(1)
 

!   OPEN #1:screen .75,1,.6,1
!   SET COLOR 06
!   PRINT "    ";date$[5:6];"/";date$[7:8];"/";date$[1:4]
!   PRINT "   "
!   PRINT "   PLUS 1 PRIMES "
!   SET COLOR 2
!   PRINT "    LEVEL ";level
!   SET COLOR 4
!   SET COLOR 06
!   PRINT "   "
!   PRINT "  Four arrow keys"
!   PRINT "    and end key"
!
!   SET COLOR 10
!   CLOSE #1
 
 

   LET rr = 1

      GET KEY next
      SELECT CASE next
      CASE 328
           LET level = level+1
           LET level2 = level2+1
           LET rr = 2
      CASE 333
           LET level = level+10
           LET level2 = level2+10
           LET rr = 2
      CASE 331
           LET level = level-10
           LET level2 = level2-10
           LET rr = 2
      CASE 336
           LET level = level - 1
           LET level2 = level2-1
           LET rr = 2
      CASE 335
           CLEAR
           CLOSE #2
           LET rrx = 3
           EXIT DO
      CASE else
           SET CURSOR 5,5
           LET rr = 1
      END SELECT

   if rrx = 3 then
      EXIT DO
   END IF
   INPUT PROMPT "LEVEL? ":level
   !        INPUT PROMPT "LEVEL2? ":level2
   !END SELECT
   LET x = 0
   SET CURSOR "off"
   CLOSE #2
LOOP
OPEN #1:screen 0,1,0,1

CLEAR
SET MODE "history"
END