Nine steps:
ADJNLHCMNR
Taken from the output of:
DECLARE SUB addon ()
CLEAR , , 25000
CLS
DATA abcd-,efgh-,--ijk,-lm-n,op-qr
DIM SHARED g$(5, 5)
FOR r = 1 TO 5
READ row$
FOR c = 1 TO 5
g$(r, c) = MID$(row$, c, 1)
NEXT
NEXT
DIM SHARED mvs$, currR, currC, prevDR, prevDC
currR = 1: currC = 1: mvs$ = "a"
addon
SUB addon
sz = 3 - ((LEN(mvs$) - 1) MOD 3)
FOR dr = -1 TO 1
FOR dc = -1 TO 1
IF dr <> 0 OR dc <> 0 THEN
IF (dr <> prevDR OR dc <> prevDC) AND (dr <> -prevDR OR dc <> -prevDC) THEN
newR = currR + dr * sz: newC = currC + dc * sz
IF newR >= 1 AND newR <= 5 AND newC >= 1 AND newC <= 5 THEN
IF g$(newR, newC) <> "-" THEN
saveR = currR: saveC = currC
currR = newR: currC = newC
saveDR = prevDR: saveDC = prevDC
prevDR = dr: prevDC = dc
mvs$ = mvs$ + g$(currR, currC)
IF g$(currR, currC) = "r" THEN
PRINT mvs$
ELSE
IF LEN(mvs$) < 12 THEN
addon
END IF
END IF
mvs$ = LEFT$(mvs$, LEN(mvs$) - 1)
prevDR = saveDR: prevDC = saveDC
currR = saveR: currC = saveC
END IF
END IF
END IF
END IF
NEXT dc
NEXT dr
END SUB
adjmcaehlpr
adjnlfcmefr
adjnlfcmnr
adjnlhcmefr
adjnlhcmnr
|