zurück

Wortfolgen suchen

DECLARE FUNCTION io% (p%)
CLS
g% = 2
l% = 12
DIM SHARED z%(l%)
t% = 0
DO 'betrachte z%(1 to t%)
DO WHILE io%(t%)
FOR r% = 1 TO t%
PRINT z%(r%);
NEXT r%
PRINT
IF t% = l% THEN EXIT DO
t% = t% + 1
z%(t%) = 0
LOOP
DO WHILE z%(t%) = g%
t% = t% - 1
IF t% = 0 THEN GOTO ende
LOOP
z%(t%) = z%(t%) + 1
LOOP
ende:
PRINT
COLOR 10
PRINT " FERTIG"
COLOR 0


Unterprogramm

FUNCTION io% (p%)
FOR l% = 1 TO INT(p% / 3)
x% = -1
DO
x% = x% + 1
LOOP UNTIL x% = l% OR z%(p% - x%) <> z%(p% - x% - l%) OR z%(p% - x%) <> z%(p% - x% - 2 * l%)
IF x% = l% THEN
io% = 0
EXIT FUNCTION
END IF
NEXT l%
io% = 1
END FUNCTION