10 REM     PIG LATIN
20 REM     FROM KILOBAUD MICROCOMPUTING
30 REM     OCTOBER 1979 #34 P.162
40 REM     WRITTEN BY KEN KLOSSON
50 REM     ADAPTED FOR THE OSBORNE 1
60 REM     BY RAY GORDON JR.
70 REM
80 REM  LIST VOWELS AND ENDING CHARACTERS
90 FOR I=1 TO 5:READ V$(I): NEXT
100 DATA A,E,I,O,U
110 FOR I=1 TO 5:READ EC$(I): NEXT
120 DATA ".",";","?","!"," "
130 DIM L$(100): DIM P$(100): W3$="AY":CR$="#"
140 REM    ADJUST SCREEN WIDTH
150 LET TW=52
160 PRINT CHR$(26)
170 PRINT:PRINT:PRINT
180 PRINT TAB(19);"AUTOMATED"
190 PRINT
200 PRINT TAB(19);"LANGUAGE"
210 PRINT
220 PRINT TAB(18);"TRANSLATION"
230 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
240 PRINT TAB(18);"PIG LATIN"
250 PRINT:PRINT
260 PRINT "      ENTER LINE TO BE TRANSLATED"
270 PRINT
280 REM      GET INPUT
290 LET LC=-1:LET BW=1: INPUT L$
300 REM      READY FOR FULL TEXT?
310 IF L$="/" OR L$="?" THEN 590
320 REM     CRLF
330 P$(N)=CR$:N=N+1
340 REM    TAKE L$ ONE CHARACTER AT A TIME
350 FOR A=1 TO LEN (L$)
360 LET L1$=MID$(L$,A,1)
370 REM  FIND FIRST VOWEL AND ENDING CHARACTER
380 FOR B=1 TO 5
390 IF L1$<>EC$(B) OR BW<>A THEN 410
400 LET BW=BW+1: P$(N-1)=P$(N-1)+L$:GOTO 470
410 IF LC<>-1 THEN 440
420 IF L1$=V$(B) THEN LC=A-BW
430 IF L1$="Y" AND A>BW THEN LC=A-BW
440 IF L1$=EC$(B) THEN EW=A: W4$=EC$(B):GOTO 500
450 NEXT B
460 IF A=LEN(L$) THEN EW=A+1: W4$=EC$(5):GOTO 500
470 NEXT A
480 PRINT:PRINT:PRINT:GOTO 290
490 REM   TRANSLATE AND PRINT EACH INPUT
500 LET W$=MID$(L$,BW,EW-BW)
510 IF LC<1 THEN P$(N)=W$+W3$+W4$:GOTO 550
520 LET W1$=RIGHT$(W$,LEN(W$)-LC)
530 LET W2$=LEFT$(W$,LC)
540 LET P$(N)=W1$+W2$+W3$+W4$
550 PRINT P$(N);
560 LET N=N+1:LET BW=EW+1: LET LC=-1
570 GOTO 470
580 REM     FULL TEXT TRANSLATION
590 LET CC=0
600 FOR C=1 TO N-1
610 IF P$(C)=CR$ THEN PRINT: GOTO 640
620 IF CC+LEN(P$(C))>TW THEN LET CC=0: PRINT
630 PRINT P$(C);
640 LET CC=CC+LEN(P$(C))
650 NEXT C
660 IF L$="/" THEN 680
670 PRINT: GOTO 290
680 END
LET CC=0: PRINT
630 PRINT P$(C);
640 LET CC=CC+LEN(P$(C))
650 