Program: Twin.bas

Implementation Select: Implementation
Operation Select: Program: TWIN.BAS
DEFDBL A-Z
DECLARE SUB GETTIME (time1$, sec)
DECLARE SUB GETSECS (time1$, sec)
'                       TWIN.BAS
'       Revision 1.0    Original                            17 Mar 1998
'
DIM SHARED secbase
SCREEN 12
COLOR 7
strtime$ = TIME$
GETSECS TIME$, secstr     ' Start time of experiment
seccor = secbase        ' correction
secold = -1
c = 300000
v = .6 * c
CLS
secstr = secstr - seccor
GETTIME strtime$, secstr            ' Startime corrected
LOCATE 1, 10: PRINT "Start time "; strtime$; TAB(40); "v = 0.6 * c"
LOCATE 24, 1: PRINT "Distance is in lightseconds "
LOCATE 25, 1: PRINT "A' = A - Distance"; TAB(30); "A'' = A - 2 * Distance"
LOCATE 26, 1: PRINT "B' = B - Distance"; TAB(30); "B'' = B - 2 * Distance"
DO
  COLOR 7
  GETSECS TIME$, seca
  seca = seca - seccor     ' Time of A
  dsec = seca - secstr       ' D Time since start
  secab = dsec * .6        ' D Time between A and B
  IF dsec > 60 THEN secab = 60 * .6 - (dsec - 60) * .6
  seca1 = seca - secab     ' Time of A at B
  seca11 = seca1 - secab   ' Time of A at A via B
  tcor = dsec * SQR(1 - (v * v) / (c * c))
  secb = secstr + tcor
  secb1 = secb - secab     ' Time of B at A
  secb11 = secb1 - secab   ' Time of B at B via A
  GETTIME timea$, seca     ' Time of A
  GETTIME timeb$, secb     ' Time of B
  GETTIME timea1$, seca1   ' Time of A at B
  GETTIME timea11$, seca11 ' Time of A at A via B
  GETTIME timeb1$, secb1   ' Time of B at A
  GETTIME timeb11$, secb11 ' Time of B at B via A
  IF dsec <= 90 THEN line1 = 13 ELSE line1 = 18
  IF dsec <= 60 THEN line1 = 8
  IF dsec <= 30 THEN line1 = 3
    colour = 15
    IF dsec = 30 OR dsec = 60 OR dsec = 90 OR dsec = 120 THEN colour = 7
    LOCATE line1, 6: PRINT "Distance = "; : COLOR colour: PRINT USING "###.#"; secab;
    COLOR 7: LOCATE line1, 41: PRINT USING "Distance * 2 = ###.#"; secab * 2
    LOCATE line1 + 1, 1: PRINT "A"; TAB(5); timea$;
    COLOR colour: PRINT USING "###.#"; TAB(20); dsec;
    COLOR 7: PRINT TAB(35); "B"; TAB(40); timeb$; TAB(60);
    PRINT USING "###.#"; TAB(60); tcor
    LOCATE line1 + 2, 1: PRINT "B'"; TAB(5); timeb1$;
    PRINT USING "###.#"; TAB(20); secb1 - secstr;
    PRINT TAB(35); "A'"; TAB(40); timea1$;
    COLOR colour: PRINT USING "###.#"; TAB(60); seca1 - secstr;
    COLOR 7: LOCATE line1 + 3, 1: PRINT "A''"; TAB(5); timea11$;
    COLOR colour: PRINT USING "###.#"; TAB(20); seca11 - secstr;
    COLOR 7: PRINT TAB(35); "B''"; TAB(40); timeb11$;
    PRINT USING "###.#"; TAB(60); secb11 - secstr;
  IF secab <> secold THEN
    LOCATE 28, 6: PRINT SPACE$(75);
    LOCATE 28, 1: PRINT "A vew";
    LOCATE 28, 43 + secab: PRINT "B";
    LOCATE 28, 43: PRINT "A"; : LOCATE 28, 80: PRINT "X";
    LOCATE 29, 6: PRINT SPACE$(75);
    LOCATE 29, 1: PRINT "B vew";
    LOCATE 29, 80 - secab: PRINT "X"; : LOCATE 29, 43 - secab: PRINT "A";
    LOCATE 29, 43: PRINT "B";
    secold = secab
  END IF
  a$ = INKEY$
LOOP UNTIL UCASE$(a$) = "E" OR dsec = 120

SUB GETSECS (time1$, sec)
  sec = VAL(MID$(time1$, 7, 2)): secbase = sec
  min = VAL(MID$(time1$, 4, 2))
  hour = VAL(MID$(time1$, 1, 2))
  sec = hour * 3600 + min * 60 + sec
END SUB

SUB GETTIME (time1$, sec)
  hour = INT(sec / 3600!)
  secs = sec - hour * 3600
  ' LOCATE 8, 1: PRINT sec; secs
  min = INT(secs / 60)
  min$ = LTRIM$(STR$(min))
  IF LEN(min$) = 1 THEN min$ = "0" + min$
  secs = secs - min * 60 + .0001
  ' LOCATE 8, 1: PRINT sec; secs
  secs! = INT(secs * 10) / 10
  secs$ = LTRIM$(STR$(secs!))
  ' COLOR 12: PRINT secs$; : COLOR 7
  IF LEN(secs$) = 1 THEN secs$ = "0" + secs$
  IF secs! > 0 AND secs! < 1 THEN secs$ = "00" + secs$
  IF LEN(secs$) = 2 THEN secs$ = secs$ + ".0"
  IF LEN(secs$) = 3 THEN secs$ = "0" + secs$
  time1$ = STR$(hour) + ":" + min$ + ":" + secs$
END SUB


Back to my home page Contents of This Document