3wHÐS( M(N(>F > ÿÿ~ ŽÞ‚Éd. ¡ ****** Crossword puzzle generator ****** n. ¡ ****** by David Crawford **** Jan 1984 * o · p? »:Š A=1™7:ŠB=1™10:ŠC=1™3:ƒß(191);:‹C:ŠC=1™3:ƒß(192);:‹C:‹B:ƒ r8 ŠB=1™10:ŠC=1™3:ƒß(192);:‹C:ŠC=1™3:ƒß(191);:‹C:‹B:ƒ:‹A t3 ±23,6:ƒ"C R O S S W O R D":±26,8:ƒ "P U Z Z L E" u ±30,10:ƒ" by D.M.Crawford" v Û 0,32 x9 ·:¯:ƒ›(21);"Crossword Puzzle Generator ":ª ‚x ƒ\" This program will generate a crossword puzzle.You will need"\"to have chosen up to 40 words with their clues." Œ ƒ\" As you are prompted, type in the words and their clues."\"The computer will position each word and show a matrix which" –© ƒ"indicates the state of the crossword after each word, at the"\"same time storing the clues in memory."\\" When you have completed your entries, press [ESC] and "  T ƒ"the crossword puzzle, complete with clues and the solution,"\"will be printed." ª ® (6000) ´O Œ A1(15,15),C1(40),X0(20),C2(40),C3(40),C4(40),C5(40),C6(40),L(40),A7(15,15) ¾ Ÿ140,1 È& Š Z=1 ™ 15:ŠY=1 ™ 15: A1$(Y,Z)="." Ò ‹Y:‹Z ÜF ¯:±5,15:ƒ" [ Press the space bar when you are ready to go on. ] ":ª æ M0$=Þ:„ M0$=""‰230 ð ·:T=0 ú ¡ ***** INPUT WORDS *****  Q=1 # A3$="abcdefghijklmnopqrstuvwxyz" ] ±35,1:ƒ"Press [ESC] to print":±35,2:ƒ"Press [LINE FEED] to cancel":±35,3:ƒ"current entry." 4 ±35,4:ƒ"Press [^] to cancel":±35,5:ƒ"last entry." > ±6,16:ƒ"Max.Length: word - 15 letters : clue - 50 letters"; "" ±35,6:¯:ƒ"Word # "Q" ";:±46,6:ª , M=1 6 W0$="":N=0:V=0 @ F2$=Þ:„F2$=""‰320 J „M>1‰335ˆ„F2$=" "‰320 O „N=0³F2$=ß(13)‰320 T „Á(A3$,F2$)>0‰380ˆZ1$=F2$ ^H Á (ß(13)+ß(8)+ß(127)+ß(10)+ß(27)+ß(94),F2$)480,405,405,470,420,515 r 395 | Z1$=ß(Å(F2$)-32) † Z1$=Z1$(;2,2) ‹„M=1³N=15‰320 Œ „M>1³N=50‰320 Ž „V=0:„N=29‰±35,9:V=1  ƒZ1$;:W0$=W0$+Z1$:N=N+1:320 • „N=29‰±64,8:V=0 – „N=0‰320 š0 „N>0‰ƒß(127);:N=N-1:W0$=W0$(;1,N):Z1$="":320 ¤ Q=Q-1:’1540:’1900 ®< ·:±10,7:ƒ"Do you want to print the puzzle again? [ Y/N ]" ¸ M0$=Þ:„M0$=""‰440 Â$ „M0$="Y"´M0$="y"‰’1540:’1890:430 Ç 1850 Ì 430 Öw ±35,6:ƒ" ":±35,8:ƒ" ":±35,9:ƒ" ":280 àF „M=1‰C1$(Q)=W0$:L(Q)=À(C1$(Q)):±35,7:¯:ƒ" Clue ";:±35,8:ª:M=2:310 ê C2$(Q)=W0$ ô& „ Q=1‰’520ˆ’610:Q=Q+1:„Q>30‰510ˆ280 þ 420  ’ 2170  280  ¡ **** Puzzle generator ****  ¡ * position first word *  B2$=C1$(1) & O=8:A=1:Y=(15-L(1))/2+1 0 B2$=C1$(1) : Š Z=Y ™ Y+L(1)-1 D A1$(O,Z)=B2$(;A,A):A=A+1:‹Z N0 ·:Š A =1 ™ 15:ŠB=1™15:ƒ A1$(A,B)" ";:‹B:ƒ:‹ A X • b ¡ * position other words * l A=Q:¡ Each word q* ŠC=1™15:ŠD=1™15:A7$(C,D)=A1$(C,D):‹D:‹C v6 D1$=C1$(A):ŠB=1 ™ L(A) :¡ Each word:each letter €8 Š X=1 ™ 15:Š Y = 1 ™ 15: ¡ co-ordinates of XWORD Š M=0 ” „ D1$(;B,B)<>A1$(X,Y)‰950 ž J=B:K=Y ¨2 ¡ do letters or spaces to left allow insertion? ²^ „ Y=1‰700ˆ„K=1‰700ˆ„B>Y‰810ˆ„J>1:„A1$(X,K-1)=D1$(;J-1,J-1)´A1$(X,K-1)="."‰J=J-1:K=K-1:690 ¼ „J=1‰M=M+1 Æ J=B:K=Y Ð3 ¡ do letters or spaces to right allow insertion? Úl „Y=15‰740ˆ„K=15‰740ˆ„L(A)-B>15-Y‰810ˆ„J1:„M=2:C=1:ŠZ=Y-1 ™ Y-B+1š-1:A1$(X,Z)=D1$(;B-C,B-C):C=C+1:‹ Z F „Bc M=0:„X=1‰840ˆ„K=1‰840ˆ„B>X‰950 ˆ„J>1:„A1$(K-1,Y)=D1$(;J-1,J-1)´A1$(K-1,Y)="."‰J=J-1:K=K-1: 830 H „J=1‰M=M+1 R K=X:J=B \0 ¡ do letters or spaces below allow insertion? fl „X=15‰880ˆ„K=>15‰880ˆ„L(A)-B>15-X‰950ˆ„J1:„M=2:C=1:ŠZ=X-1 ™ X-B+1š-1:A1$(Z,Y)=D1$(;B-C,B-C):C=C+1:‹ Z ŽE „B1:„A1$(X,Y-B)<>"."‰M=0:1090:¡ Are ends of word clear? ü2 „Y+L(A)-B<15:„A1$(X,Y+L(A)-B+1)<>"."‰M=0:1090 ) „B>2:P=0:ŠZ=Y-B+1 ™ Y-1:’1100:‹Z:1060  „B=2‰Z=Y-1:P=0:’1100  „B=1‰P=0 $- „ B"."‰1150:¡ Is letter on each side0? ` P=P+1 j# U=U+1:„X>1:„A1$(X-1,Z)<>"."‰1150 t P=P+1:1260 ~ ŠS=1™Q ˆ G0$="" ’G „X+L(S)-1>15³X-L(S)+1<1‰1180ˆ„X+L(S)-1>15‰1200ˆ„X-L(S)+1<1‰1190ˆ1210 œ ŠR=1™15:1220 ¦ Š R=1™X+L(S)-1:1220 ° ŠR=X-L(S)+1™15:1220 º ŠR=X-L(S)+1 ™ X+L(S)-1 Ä G0$=G0$+A1$(R,Z):‹R Î „Á(G0$,C1$(S))>0‰P=P+1:1250 Ø ‹ S:1260 â" „U=2‰‹* S 1260 ˆ „U=1‰‹* S 1130 ì • ö3 ¡ ::: search surrounding letters (vertical) :::: B „X-B+1>1:„A1$(X-B,Y)<>"."‰M=0:1360:¡ Are ends of word clear?  2 „X+L(A)-B<15:„A1$(X+L(A)-B+1,Y)<>"."‰M=0:1360 ) „B>2:P=0:ŠZ=X-B+1 ™ X-1:’1370:‹Z:1330  „B=2‰Z=X-1:P=0:’1370 ( „B=1‰P=0 2- „ B"."‰1420:¡ Is letter on each side 0? n P=P+1 x# U=U+1:„Y>1:„A1$(Z,Y-1)<>"."‰1420 ‚ P=P+1:1530 Œ Š S=1 ™ Q – G0$=""  G „Y+L(S)-1>15³Y-L(S)+1<1‰1450ˆ„Y+L(S)-1>15‰1470ˆ„Y-L(S)+1<1‰1460ˆ1480 ª ŠR=1™15:1490 ´ Š R=1™Y+L(S)-1:1490 ¾ ŠR=Y-L(S)+1™15:1490 È ŠR=Y-L(S)+1 ™ Y+L(S)-1 Ò G0$=G0$+A1$(Z,R):‹R Ü „Á(G0$,C1$(S))>0‰P=P+1:1520 æ ‹ S: 1530 ð# „U=2‰‹* S 1530 ˆ „U=1‰‹* S 1400 ú • " ¡ numbering appropriate squares Œ ·:±10,8:ƒ"PRESS ANY KEY WHEN PRINTER IS ON LINE."\\"YOU WILL NEED TO HAVE THE PRINTER SET AT 15 CHRS TO THE INCH"\"AND 1 SPACE PER LINE."  M0$=Þ:„M0$=""‰1560 " ŠZ=1™75:‚ß(95);:‹Z:‚ ,$ G=0:H=0:K=1:E=1:ŠA=1™ 15:ŠB=1™ 15 6 „A1$(A,B)="."‰’1720: 1710 @ G0$="":F0$="":I=0 JK „B<15:„A1$(A,B+I)="."‰1620ˆG0$=G0$+A1$(A,B+I):„B+I=15‰1620ˆI=I+1:1610 T I=0 Y Š C=1™Q:„G0$<>C1$(C)‰1640 c „B>1:„ A1$(A,B-1)<>"."‰1640 e1 F=1:G=G+1:C3$(G)=Ý(E):C4$(G)=C2$(C):‹* C 1650 h ‹ C rL „A<15:„A1$(A+I,B)="."‰ 1660ˆF0$=F0$+A1$(A+I,B):„A+I=15‰1660ˆI=I+1:1650 | I=0 † ŠC=1™ Q:„F0$<>C1$(C)‰1680 ‹ „A>1:„ A1$(A-1,B)<>"."‰1680 1 F=1:H=H+1:C5$(H)=Ý(E):C6$(H)=C2$(C):‹* C 1690  ‹ C š „F=1‰’1750:E=E+1:1710 ¤ „F=0‰’1780:1710 ® F=0:‹B:‹A:1810 ¸2 ‚›(K);"|////":‚›(K);"|////";:‚ß(27)ß(10);:K=K+5 Â? „K>71‰‚›(K);"|":‚›(K);"|";:‚ß(13);:K=1:ŠZ=1™75:‚ß(95);:‹Z:‚ Ì • Ö4 ‚›(K);"|"E" ":‚›(K);"| ";:‚ß(27)ß(10);:K=K+5 à? „K>71‰‚›(K);"|":‚›(K);"|";:‚ß(13);:K=1:ŠZ=1™75:‚ß(95);:‹Z:‚ ê • ô2 ‚›(K);"| ":‚›(K);"| ";:‚ß(27)ß(10);:K=K+5 þ? „K>71‰‚›(K);"|":‚›(K);"|";:‚ß(13);:K=1:ŠZ=1™75:‚ß(95);:‹Z:‚  •  ¡ print clues I ‚\:‚ß(27)ß(69);:‚›(1);"CLUES ACROSS";:‚›(55);"CLUES DOWN":‚ß(27)ß(82); &9 ŠZ=1™G:‚C3$(Z)". "C4$(Z):‹Z:‚:ŠZ=1™G+2:‚ß(27)ß(10);:‹Z 0( ‚:ŠZ=1™H:‚›(55);C5$(Z)". "C6$(Z):‹Z:• : Ÿ 140,0:‘ b ¡ Print solution lc ‚:‚›(6)"SOLUTION":‚ß(27)ß(30)ß(7);:ŠX=1™15:ŠY=1™15:‚A1$(X,Y)" ";:‚ß(27)ß(8);:‚ß(27)ß(8);:‹Y:‚:‹X v ‚ß(27)ß(83);:• Ð ¡ record 'Failed' words Ú T=T+1:X0$(T)=D1$:Q=Q-1 ä) „T=0‰2160ˆ±35,10:¯:ƒ"'Failed' Words":ª î„M<2³T=1‰2120 ø „M<2³T>1‰2130  „M=2³T>1‰2080   „M=2³T=1‰2070  „X0$(1)=D1$‰2110   ŠA=1™T:„X0$(A)=D1$‰2100 * ‹A:2120 4% „A T=T-1 H$ „T=0‰2160ˆ„T=1‰±675:ƒX0$(T):2160 R5 „T>5‰2140ˆI=611:ŠA=1™T:I=I+64:±I:ƒX0$(A):‹A:2160 \@ I=611:ŠA=1™5:I=I+64:±I:ƒX0$(A):‹A:I=690:„T=6‰±I:ƒX0$(6):2160 f ŠA=6™T:I=I+64:±I:ƒX0$(A):‹A p • z ¡ cancel last entry  „Q=1‰Q=Q+1:2190 „= ·:Š A=1™15:ŠB=1™15:A1$(A,B)=A7$(A,B):ƒA1$(A,B)" ";:‹B:ƒ:‹A Ž Q=Q-1:• ÿÿ"{Í "!%Íæ 8s#rÉåÕÅ*ç$T]xÆ…o|Îg"ç$##6++DM*%{½ z¼( òÁÑs#r#pÑ#wúÉÕå!,ÑÕ##å~#·(,¸8 OÍx$( á~#ÍŒ