won't print to screen

The following program won't print to screen in 6.007 using Windows 7:

option nolet
dim ww(500,50)

for a=0 to 1
for b=0 to 1
for c=0 to 1
for d=0 to 1
for e=0 to 1
for h=0 to 1
for k=0 to 1
for l=0 to 1
for m=0 to 1
for n=0 to 1
for r=0 to 1
for s=0 to 1
for t=0 to 1
for v=0 to 1
for w=0 to 1
for z=0 to 1
for aa=0 to 1
for bb=0 to 1

if s=0 then rs=1
if rs<>r then bad=1
if m=0 and h=1 then ds=0
if ds<>d then bad=1
a=1
k=0
if l=1 and n=1 then vs=1
if vs<>v then bad=1
if z=1 and m=1 then cs=0
if cs<>c then bad=1
if t=1 then aas=1
if aas<>aa then bad=1
if s=0 and n=0 and c=1 then rs=0
if rs<>r then bad=1
if z=1 and v=1 then ms=1
if ms<>m then bad=1
w=1
if v=1 and k=1 and m=1 then ts=1
if ts<>t then bad=1
s=1
c=1
n=0
if aa=1 then bbs=0
if bbs<>bb then bad=1
if k=1 and h=0 then ns=1
if ns<>n then bad=1
if r=1 then cs=1
if cs<>c then bad=1
if v=0 and a=0 and h=0 then ls=1
if ls<>l then bad=1
if w=1 and t=0 and s=1 then ns=1
if ns<>n then bad=1
if d=1 then es=1
if es<>e then bad=1
if d=1 then ks=1
if ks<>k then bad=1
if s=1 and n=1 and b=0 then bbs=1
if bbs<>bb then bad=1
if w=1 and e=1 then zs=1
if zs<>z then bad=1
if t=0 and aa=0 and r=0 and c=0 then ns=0
if ns<>n then bad=1

if bad=0 then
jj=jj+1
ww(jj,1)=a
ww(jj,2)=b
ww(jj,3)=c
ww(jj,4)=d
ww(jj,5)=e
ww(jj,6)=h
ww(jj,7)=k
ww(jj,8)=l
ww(jj,9)=m
ww(jj,10)=n
ww(jj,11)=r
ww(jj,12)=s
ww(jj,13)=t
ww(jj,14)=v
ww(jj,15)=w
ww(jj,16)=z
ww(jj,17)=aa
ww(jj,18)=bb
end if
bad=0

next bb
next aa
next z
next w
next v
next t
next s
next r
next n
next m
next l
next k
next h
next e
next d
next c
next b
next a

print "jj=";jj
print
for i=1 to jj

if ww(i,4)=1 then
for mm=1 to 18
print mm;ww(i,mm)
next mm
print
print
end if

next i

print "finished"
end

Comments

won't print to screen...infinite loop

Hi,
Your program doesn't print anything because it gets hung in an infinite loop before it ever encounters a "print" statement. Not a problem with any TB version, or with Windows.

Down around where "bb becomes either =1 or =0", and thence to "if l=1 and n=1 then vs=1", you have an infinite loop, because "bad" keeps on coming out "=1", from which it never recovers.

Put a few "get key" statements at various points and print some of the variable values at those points and you will quickly see that it gets hung up.

For example, to see this looping, add the following lines:

at the line: "for bb=0 to 1",

add the lines:

print,"Line [whatever]: bb=";bb ! you can put in whatever the line number is
get key zz

At the line: "if l=1 and n=1 then vs=1"

add the lines:

print,,"Line [whatever] 'if L=1 and n=1 then vs=1': L=";L;" n=";n; " bad=";bad
get key zz

You may have to FLOW CHART the program because with such a tangle as this is, it's hard to see the problem.

Beyond this, I don't know what to tell you to do to fix it, because I have no idea of what's supposed to be happening. (Too bad this forum screws up any formatting one tries to post. Oh well...)

Hope this helps.

Mike C.

won't print to screen resolved

Mike,
Thanks so much for taking the time to help. You're right about the infinite loop. After looking at it the problem was easy to spot. I had several of the looping variables (a,k, and others) reset to a constant (0 or 1) inside of the loop. So the ones that were reset to 0 inside the loop could never get to 1 to complete the loop. Thanks again.
Bob