Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site pyuxss.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!pyuxww!pyuxss!aaw From: aaw@pyuxss.UUCP (Aaron Werman) Newsgroups: net.puzzle Subject: Re: how many words can you make from gorilla? Message-ID: <313@pyuxss.UUCP> Date: Thu, 19-Apr-84 13:05:31 EST Article-I.D.: pyuxss.313 Posted: Thu Apr 19 13:05:31 1984 Date-Received: Fri, 20-Apr-84 01:44:58 EST References: <1532@vax4.fluke.UUCP> Organization: Bell Communications Research, Piscataway N.J. Lines: 34 -1**.5 word permutation games are boring, unless they lead to insights, so anyone who tries computer generated answers gets bored real soon and quits. Brute force techniques in polynomial time/space should not be used to play games, except by the patient. Other techniques (digram frequency, or other context sensitive heuristics) are not exhaustive. Here is an example of a piddling brute force program which will merrily mutilate /tmp in nonreal time: # sh WORTHLESS ALGOLAGNIAC PROGRAM # DO NOT TRY THIS PROGRAM ON COMPUTER-INSTEAD HAND INTERPRET IT if [ $# != 1 ]; then echo 'Usage: permute '; exit; fi trap "rm $AFILE $BFILE" 0 2 5 IN=/tmp/p$$ OUT=/tmp/q$$ AWKSCRIPT=' { for (i = length; i >= 0; i--) print substr($0,1,i) CHAR substr($0, i + 1) }' expr $1 : '\(.\).*'>$IN for LETTER in `expr $1 : '.\(.*\)'|sed 's/./& /g'` do awk "$AWKSCRIPT" CHAR=$LETTER $IN >$OUT TEMP=$OUT;OUT=$IN;IN=$TEMP done if [ $TEMP = $OUT ] then cat $OUT else cat $IN fi rm $IN $OUT # after hand running the program on the word of your choice, # run the output through a bunch of cut(1)s, sort, uniq (all # by hand, please, computers were not meant for this quantity of I/O) # you will have your combinations. Rots of Ruck {harpo,houxm,ihnp4}!pyuxss!aaw Aaron Werman