The word array is NPCpathes$:
NPCpaths$ = ""
NPCchoices = 0
moveup$ = "moveup "
movedown$ = "movedown "
moveleft$ = "moveleft "
moveright$ = "moveright "
IF gridY < NPCgridY THEN
NPCpaths$ = NPCpaths$ + moveup$
NPCchoices = NPCchoices + 1
END IF
IF gridY > NPCgridY THEN
NPCpaths$ = NPCpaths$ + movedown$
NPCchoices = NPCchoices + 1
END IF
IF gridX < NPCgridX THEN
NPCpaths$ = NPCpaths$ + moveleft$
NPCchoices = NPCchoices + 1
END IF
IF gridX > NPCgridX THEN
NPCpaths$ = NPCpaths$ + moveright$
NPCchoices = NPCchoices + 1
END IF
NPCpickchoice = RANDOM NPCchoices
NPCaction$ = WORD$ NPCpaths$ NPCpickchoice
It's used to determine which direction the NPC will travel in. Rogue Frog's code is slightly different to this, but it's the same basic thing. QoM uses the system as well.