Msg: 4352 *Conference*

05-28-93 20:28:18

From: CARROLL LEWIS

To : ALL

Subj: MAGIC

                   THIS HAS GOT TO BE PURE COMPUTER MAGIC !
 
 I KNOW that there HAS to be someone out there who can explain this to me.
 
 This is the routine which sets up the "image" for a  3 of 9 bar code. Here I
have set "Z" to 9 which is the data for the number 1 (don't ask me why).
 
  In the program Z will have 44 different values, ranging from 3 to 208. Each
value of Z passes through this loop and has a totally different "image". The
loop begins at 10 and ends at 40 (without the print command).
 
                        LOAD AND RUN: SHIFT/BREAK TO EXIT
 
   0
DEFSTRA-D:V=255:X=128:A(0)=STRING$(4,X):A(2)=STRING$(3,V):B(0)=STRING$(2,X):B(2)
=CHR$(V):Z=9
   10 T=1:Y=T:X=0:FORW=0TO7
   20 IFZ AND T THENX=X+1:D=D+A(Y+1)ELSE D=D+B(Y+1)
   30 Y=-Y:T=T+T:PRINTD:NEXT
   40 IFX<3THEN D=D+A(2)ELSE D=D+B(2)
   50 PRINTD
   60 GOTO 60
 
 
   I understand everything except the comparison in line 20. What IS  the
comparison?. How is it that when Z (which is always 9) is compared "AND" with
T (1,2,4,8,16,32,64,128) the results are different? What is it, what is
happening, WHAT IS GOING ON ??? I can't even tell if this is a relational or
logical expression!
 
   Some of my programming has been realitively easy for me, because I am very
"logic" based in my thinking. This however, is beyond my logic. My logic says
"IF Z (has a value) AND T (has a value) THEN"... would always be "true" so, WHY
DOES IT WORK ?
 
  In pass W(0)  Z=9  T=1   Y=1   X=0    TRUE  D becomes a wide bar
  In pass W(1)  Z=9  T=2   Y=-1  X=1    FALSE adds a small space
  In pass W(2)  Z=9  T=4   Y=1   X=1    FALSE adds a small bar
  In pass W(3)  Z=9  T=8   Y=-1  X=1    TRUE  adds a wide space
  In pass W(4)  Z=9  T=16  Y=1   X=2    FALSE adds a small bar
  In pass W(5)  Z=9  T=32  Y=-1  X=2    FALSE adds a small space
  In pass W(6)  Z=9  T=64  Y=1   X=2    FALSE adds a small bar
  In pass W(7)  Z=9  T=128 Y=-1  X=2    FALSE adds a small space
 
  The loop ends and line 40 will add one more bar, wide or small, dependant on
the value of X (3of9 gets its name from THREE of the NINE bars and spaces being
WIDE).
 
  Anyone?
 
   -Carroll Lewis-