10 REM ORG unknown
20 REM Modified by Ben Miller 4/26/79 (up to 11 characters)
30 REM Modified by Ben Miller 11/17/79 (much faster)
40 REM Modified by Keith Petersen 12/1/79 (move DIM, add DEFINT)
50 REM Modified for MBASIC 5.x by Keith Petersen, W8SDZ, 6-Jul-87
60 DEFINT A-Z:DIM M$(11)
70 PRINT TAB(28);"JUMBLE version 12"
80 PRINT
90 INPUT "Input your jumbled characters up to (11 max. & 3 min.).";I$
100 N=LEN(I$)
110 IF N<3 THEN 90
120 IF N>11 THEN 90
130 PRINT
140 PRINT "If you want a separation of characters then enter"
150 S1=0:INPUT "the number of characters in the first group";S1
160 PRINT:PRINT "Press any key to stop.":PRINT
170 IF S1>10 THEN 90
180 K1=0
190 C=0
200 FOR X=1 TO N
210 M$(X)=MID$(I$,X,1)
220 NEXT X
230 S$=INKEY$
240 FOR X1=1 TO N
250 FOR X2=1 TO N
260 FOR X3=1 TO N
270 IF N=3 THEN 510
280 IF INKEY$<>S$ THEN 1260
290 FOR X4=1 TO N
300 IF N=4 THEN 510
310 IF INKEY$<>S$ THEN 1260
320 FOR X5=1 TO N
330 IF N=5 THEN 510
340 IF INKEY$<>S$ THEN 1260
350 FOR X6=1 TO N
360 IF N=6 THEN 510
370 IF INKEY$<>S$ THEN 1260
380 FOR X7=1 TO N
390 IF N=7 THEN 510
400 IF INKEY$<>S$ THEN 1260
410 FOR X8=1 TO N
420 IF N=8 THEN 510
430 IF INKEY$<>S$ THEN 1260
440 FOR X9=1 TO N
450 IF N=9 THEN 510
460 IF INKEY$<>S$ THEN 1260
470 FOR R1=1 TO N
480 IF N=10 THEN 510
490 IF INKEY$<>S$ THEN 1260
500 FOR R2=1 TO N
510 IF X1=X2 THEN 820
520 IF X1=X3 THEN 810
530 IF N=3 THEN 550
540 IF X1=X4 THEN 800
550 IF X2=X3 THEN 810
560 IF N=3 THEN 720
570 IF X4=X2 OR X4=X3 THEN 800
580 IF N=4 THEN 720
590 IF X5=X1 OR X5=X2 OR X5=X3 OR X5=X4 THEN 790
600 IF N=5 THEN 720
610 IF X6=X1 OR X6=X2 OR X6=X3 OR X6=X4 OR X6=X5 THEN 780
620 IF N=6 THEN 720
630 IF X7=X1 OR X7=X2 OR X7=X3 OR X7=X4 OR X7=X5 OR X7=X6 THEN 770
640 IF N=7 THEN 720
650 IF X8=X1 OR X8=X2 OR X8=X3 OR X8=X4 OR X8=X5 OR X8=X6 OR X8=X7 THEN 760
660 IF N=8 THEN 720
670 IF X9=X1 OR X9=X2 OR X9=X3 OR X9=X4 OR X9=X5 OR X9=X6 OR X9=X7 OR X9=X8 THEN 750
680 IF N=9 THEN 720
690 IF R1=X1 OR R1=X2 OR R1=X3 OR R1=X4 OR R1=X5 OR R1=X6 OR R1=X7 OR R1=X8 OR R1=X9 THEN 740
700 IF N=10 THEN 720
710 IF R2=X1 OR R2=X2 OR R2=X3 OR R2=X4 OR R2=X5 OR R2=X6 OR R2=X7 OR R2=X8 OR R2=X9 OR R2=R1 THEN 730
720 GOSUB 890
730 IF N>=11 THEN NEXT R2
740 IF N>=10 THEN NEXT R1
750 IF N>=9 THEN NEXT X9
760 IF N>=8 THEN NEXT X8
770 IF N>=7 THEN NEXT X7
780 IF N>=6 THEN NEXT X6
790 IF N>=5 THEN NEXT X5
800 IF N>=4 THEN NEXT X4
810 IF N>=3 THEN NEXT X3
820 NEXT X2
830 NEXT X1
840 PRINT
850 A9=A9+1
860 PRINT
870 PRINT C
880 GOTO 1260
890 IF K1>5 THEN 920
900 K1=K1+1
910 GOTO 940
920 PRINT 
930 K1=1
940 C=C+1
950 PRINT M$(X1);
960 IF S1=1 THEN PRINT " ";
970 PRINT M$(X2);
980 IF S1=2 THEN PRINT " ";
990 PRINT M$(X3);
1000 IF S1=3 THEN PRINT " ";
1010 IF N=3 THEN 1240
1020 PRINT M$(X4);
1030 IF S1=4 THEN PRINT " ";
1040 IF N=4 THEN 1240
1050 PRINT M$(X5);
1060 IF S1=5 THEN PRINT " ";
1070 IF N=5 THEN 1240
1080 PRINT M$(X6);
1090 IF S1=6 THEN PRINT " ";
1100 IF N=6 THEN 1240
1110 PRINT M$(X7);
1120 IF S1=7 THEN PRINT " ";
1130 IF N=7 THEN 1240
1140 PRINT M$(X8);
1150 IF S1=8 THEN PRINT " ";
1160 IF N=8 THEN 1240
1170 PRINT M$(X9);
1180 IF S1=9 THEN PRINT " ";
1190 IF N=9 THEN 1240
1200 PRINT M$(R1);
1210 IF S1=10 THEN PRINT " ";
1220 IF N=10 THEN 1240
1230 PRINT M$(R2);
1240 PRINT "  ";
1250 RETURN
1260 PRINT:PRINT
1270 INPUT "Do you want to run this program again";Y$
1280 IF LEFT$(Y$,1)="Y" OR LEFT$(Y$,1)="y" THEN 80
1290 END
