View Single Post
  #10  
Old 01-15-2008, 06:10 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Kristi View Post
yes but you also have to find which arrangements are actually words in the dictionary.... fun fun fun
Are we given said dictionary?

edit:
NPC Code:
function arrange(letters,first) {
temp.len = letters.length();
if (first == 0) first = "";
if (temp.len > 1) {
temp.returns.clear();
temp.htable = {0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,1};
for (temp.i=0; temp.i<temp.len; temp.i++) {
temp.letter = letters.charat(temp.i).tolower();
temp.hindex = (max(96,min(123,getascii(temp.letter)))-97)%27; // maps characters outside of a-z to htable[26]
if (temp.htable[temp.hindex] == 0) {
temp.htable[temp.hindex] = 1;
temp.pref= first @ temp.letter;
temp.endings = arrange(letters.substring(0,temp.i) @ letters.substring(temp.i+1),temp.pref);
temp.returns.addarray(temp.endings);
}
}
return temp.returns;
}
else {
temp.word = first @ letters.tolower();
if (inDictionary(temp.word))
return {temp.word};
else return char(0);
}
}



Now I just need some inDictionary(word).
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 01-15-2008 at 09:03 AM..
Reply With Quote