8-Bit Software Online Conversion

Alphabet Shuffle - Listing

10REM "ALFSHUF" - One liner alphabet shuffle. 20REM J.Davis '94 30MODE7:VDU23,1,0,0;0;0;0; 40PRINTTAB(10);CHR$(141);CHR$(131);"A lphabet Shuffle" 50PRINTTAB(10);CHR$(141);CHR$(131);"A lphabet Shuffle" 60PRINTCHR$(145);STRING$(39,"s") 70PRINT" This is a one-liner. I was trying to crack an anagram by getting the Beeb to shuffle letters randomly, us ing a simple program which continu ously took a letter from a random posit ion and put"; 80PRINT" it at the beginning. This pr oduced a very surreal movement, with the letters on the left shuffling rapidl y to the right, gradually slowing dow n to nothing at the right end. Th e longer" 90PRINT" the word, the wierder the ef fect, so this program uses the whole alphabet. I then wondered if the program could be squeezed down into a one-lin er." 100PRINT" For direct control, press ESCAPE, then use Space Bar for movem ent." 110PRINT:PRINTTAB(27);"PRESS SPACE" 120PRINTCHR$(145);STRING$(39,"s") 130G=GET 140ONERROR GOTO200 150REM " The one line 160MODE7:PROCMandW:VDU23,1,0;0;0;0;:A$ ="ABCDEFGHIJKLMNOPQRSTUVWXYZ":REPEAT:R=R ND(25)+1:B$=MID$(A$,R,1):A$=B$+LEFT$(A$, R-1)+RIGHT$(A$,26-R):PRINTTAB(5,10);CHR$ (141);" ";A$:PRINTTAB(5,11);CHR$(141);" ";A$:UNTILFALSE 170DEFPROCMandW 180PRINTTAB(6,22);" What do you think of it so far..." 190ENDPROC 200ONERROR GOTO250 210MODE7:PROCz:VDU23,1,0;0;0;0;:A$="AB CDEFGHIJKLMNOPQRSTUVWXYZ":REPEAT:PRINTTA B(5,10);CHR$(141);" ";A$:PRINTTAB(5,11); CHR$(141);" ";A$:G=GET:R=RND(25)+1:B$=MI D$(A$,R,1):A$=B$+LEFT$(A$,R-1)+RIGHT$(A$ ,26-R):UNTILFALSE 220DEFPROCz 230PRINTTAB(6,22);" Press or hold Spac e Bar. ESCAPE for statist ics." 240ENDPROC 250ONERROR GOTO140 260MODE7:VDU23,1,0;0;0;0; 270PRINT" Starting each time with a fresh alphabet, this counts the nu mber of times the letter 'A' manages to get to the right hand end." 280PRINT:PRINTCHR$(145);STRING$(39,"s" ) 290PRINTTAB(6,22);" Toggle T for fast/ slow. ESCAPE for first d isplay." 300F=0:S=0:FL=1 310A$="ABCDEFGHIJKLMNOPQRSTUVWXYZ" 320R=RND(25)+1:B$=MID$(A$,R,1):A$=B$+L EFT$(A$,R-1)+RIGHT$(A$,26-R) 330PRINTTAB(5,10);CHR$(141);" ";A$:PRI NTTAB(5,11);CHR$(141);" ";A$ 340IF RIGHT$(A$,1)="A" THEN S=S+1:PRIN TTAB(23,15);" TO END: ";S:FORN=1TO3000:N EXT:GOTO310 350IFB$="A" THEN F=F+1:PRINTTAB(6,15); " NOT TO END: ";F:GOTO310 360X$=INKEY$(0) 370IFX$="T" THEN FL=FL*-1 380IFFL=-1 THEN FORN=1TO500:NEXT 390GOTO320