@verb #7951:"crossword" any any none rxdo #7951 @program #7951:"crossword" any any none found = {} if (length(args) < 2) raise(E_INVARG) elseif (typeof(args[1]) != LIST && typeof(args[2]) != $LIST) raise(E_INVARG) endif puzzle = {} lencol = 0 for x in (args[1][1..$]) if (lencol != length(x) && lencol != 0) raise(E_INVARG) endif lencol = length(x) puzzle = {@puzzle, x} endfor lenrow = length(puzzle) for word in (args[2]) $Cmd_utils:suspend_if_needed(1) "SEARCH DIAGONAL TOPLEFT TO BOTTOMRIGHT" xpos = 1 ypos = 1 string = "" for x in [1..lenrow] xpos = x ypos = 1 while (ypos <= lencol && xpos <= lenrow) string = string + puzzle[xpos][ypos] ypos = ypos + 1 xpos = xpos + 1 endwhile player:tell(string) if (index(string, word)) found = {@found, "The word " + word + " is located diagonally from top left to bottom right starting at row " + tostr(x) + ", column " + tostr(index(string, word)) + "."} player:tell(found) " setremove(args[2], word);" " break;" elseif (index($su:reverse(string), word)) found = {@found, "The word " + word + " is located diagonally and backwards from top left to bottom right starting at row " + tostr(x) + ", column " + tostr(ypos - length(word)) + "."} player:Tell(found) endif string = "" endfor for y in [2..lencol] xpos = 1 ypos = y while (ypos <= lencol && xpos <= lenrow) string = string + puzzle[xpos][ypos] ypos = ypos + 1 xpos = xpos + 1 endwhile player:tell(string) if (index(string, word)) found = {@found, "The word " + word + " is located diagonally from top left to bottom right startin at row " + tostr(x) + ", column " + tostr(index(string, word)) + "."} player:tell(found) " setremove(args[2], word);" " break;" elseif (index($su:reverse(string), word)) found = {@found, "The word " + word + " is located diagonally and backwards from top left to bottom right starting at row " + tostr(x) + ", column " + tostr(ypos - length(word)) + "."} endif string = "" endfor "SEARCH DIAGONAL TOPRIGHT TO BOTTOMLEFT" for y in [1..lencol] ypos = y xpos = 1 while (ypos >= 1 && xpos <= lenrow) string = string + puzzle[xpos][ypos] ypos = ypos - 1 xpos = xpos + 1 endwhile player:tell(string) if (index(string, word)) player:tell("found in " + string) found = {@found, "The word " + word + " is located diagonally from top right to bottom left starting from row " + tostr(xpos - length(word)) + ", column " + tostr(y) + "."} player:tell(found) " setremove(args[2], word);" " break;" elseif (index($su:reverse(string), word)) found = {@found, "The word " + word + " is located diagonally and backwards from top right to bottom left starting from row " + tostr(xpos - length(word)) + ", column " + tostr(y) + "."} endif string = "" endfor for x in [2..lenrow] xpos = x ypos = lencol string = "" while (ypos >= 1 && xpos <= lenrow) string = string + puzzle[xpos][ypos] ypos = ypos - 1 xpos = xpos + 1 endwhile player:tell(string) if (index(string, word)) player:tell("Found in " + string) found = {@found, "The word " + word + " is located diagonally from top right to bottom left in row " + tostr(x) + ", column " + tostr(ypos - length(word)) + "."} player:tell(found) " setremove(args[2], word);" elseif (index($su:reverse(string), word)) found = {@found, "The word " + word + " is located diagonally from top right to bottom left in row " + tostr(x) + ", column " + tostr(ypos - length(word)) + "."} endif endfor "SEARCH HORIZONTALLY" for x in [1..lenrow] if (index(puzzle[x], word)) found = {@found, "The word " + word + " is located horizontally in row " + tostr(x) + ", column " + tostr(index(puzzle[x], word)) + "."} elseif (index($su:reverse(puzzle[x]), word)) found = {@found, "The word " + word + " is located horizonally and backwards in row " + tostr(x) + ", column " + tostr(index(puzzle[x], word)) + "."} endif endfor "SEARCH VERTICALLY" for y in [1..lencol] xpos = 1 string = "" while (xpos <= lenrow) string = string + puzzle[xpos][y] xpos = xpos + 1 endwhile if (index(string, word)) found = {@found, "The word " + word + " is located vertically in row " + tostr(index(string, word)) + ", column " + tostr(y) + "."} elseif (index($su:reverse(string), word)) found = {@found, "The word " + word + " is located vertically and backwards in row " + tostr(index(string, word)) + ", column " + tostr(y) + "."} endif endfor endfor player:Tell(found) "Last modified by Dax (#789) on Wed May 4 06:46:04 2005 MDT." .