Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

50
Task/Amb/ERRE/amb.erre Normal file
View file

@ -0,0 +1,50 @@
PROGRAM AMB
!
! for rosettacode.org
!
!$KEY
DIM SET1$[2],SET2$[2],SET3$[2],SET4$[2]
FUNCTION WORDS_OK(STRING1$,STRING2$)
WORDS_OK=(RIGHT$(STRING1$,1)=LEFT$(STRING2$,1))
END FUNCTION
PROCEDURE AMB(SET1$[],SET2$[],SET3$[],SET4$[]->RESULT$)
RESULT$="" ! Empty string, e.g. fail
FOR A=0 TO 2 DO
FOR B=0 TO 2 DO
FOR C=0 TO 2 DO
FOR D=0 TO 2 DO
IF WORDS_OK(SET1$[A],SET2$[B]) AND WORDS_OK(SET2$[B],SET3$[C]) AND WORDS_OK(SET3$[C],SET4$[D]) THEN
RESULT$=SET1$[A]+" "+SET2$[B]+" "+SET3$[C]+" "+SET4$[D]
EXIT PROCEDURE
END IF
END FOR
END FOR
END FOR
END FOR
END PROCEDURE
BEGIN
PRINT(CHR$(12);) ! CLS
SET1$[0]="the" SET1$[1]="that" SET1$[2]="a"
SET2$[0]="frog" SET2$[1]="elephant" SET2$[2]="thing"
SET3$[0]="walked" SET3$[1]="treaded" SET3$[2]="grows"
SET4$[0]="slowly" SET4$[1]="quickly" SET4$[2]=""
AMB(SET1$[],SET2$[],SET3$[],SET4$[]->TEXT$)
IF TEXT$<>"" THEN
PRINT("Correct sentence would be:")
PRINT(TEXT$)
ELSE
PRINT("Failed to fine a correct sentence.")
END IF
PRINT
PRINT("Press any key to exit.")
REPEAT
GET(Z$)
UNTIL LEN(Z$)<>0
END PROGRAM