# Digit Span # epstej@mail.dmh.state.mo.us new #get length 10 o=fn(42) 12 t=1000 13 input "How many numbers (2-20)",x 15 if x<2 or x>20 then 10 #get direction 16 input "Forward or Backward (f/b)", x$ 17 if x$ = "f" then goto 20 18 if x$ = "b" then goto 20 19 goto 16 # generate string 20 y$="" 25 for i=1 to x 27 z=rnd(10) 28 o=fn(42):gosub ((z+1)*100) 29 gosub 90 30 o=fn(42) 31 gosub 90 32 if x$="f" then y$=y$+str$(z) 33 if x$="b" then y$=str$(z)+y$ 35 next i 40 t=250 #get guess 50 input "Enter your guess",x$ # compare 55 if x$=y$ then 70 56 sound 440,100,64:gosub 90 57 sound 340,500,64:gosub 90 60 ? "Nope: "+y$ 65 goto 80 70 sound 440,100,64:gosub 90 71 sound 440,100,64:gosub 90 72 sound 500,500,64:gosub 90 75 ? "Congratulations, You Won!" 80 input "Play Again? (y/n)",x$ 81 if x$="y" then 10 88 end 90 for j=1 to t:next j:return 100 grline 40,20,80,120,7 101 grline 60,40,40,80,-7:return 200 grline 70,20,20,120,7:return 300 grline 40,20,80,120,7 301 grline 40,40,60,40,-7 302 grline 60,100,60,20,-7:return 400 grline 40,20,80,120,7 401 grline 40,40,60,80,-7 402 grline 70,70,30,20,7:return 500 grline 40,20,80,120,7 501 grline 40,80,60,60,-7 502 grline 60,20,40,40,-7:return 600 grline 40,20,80,120,7 601 grline 60,40,60,20,-7 602 grline 40,80,60,40,-7:return 700 grline 40,20,80,120,7 701 grline 60,40,60,20,-7 702 grline 60,80,40,40,-7:return 800 grline 40,20,80,120,7 801 grline 40,40,60,100,-7:return 900 grline 40,20,80,120,7 901 grline 60,40,40,30,-7 902 grline 60,90,40,30,-7:return 1000 grline 40,20,80,120,7 1001 grline 60,40,40,20,-7 1002 grline 40,80,60,40,-7:return run