[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Anagrams
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Posted by ErockMahan   (81 posts)  [Biography] bio
Date Tue 06 Jul 2010 02:42 PM (UTC)
I'm hoping there is an easier way to do this than what I'm thinking, so I thank you in advance for helping me accomplish this.

I've got a variable string that is a set word. I'll use 'Stabs' as an example. I am then given 5 items, each of which has several key letters assigned to it. "Key of Aberforth" "Stick" "Blunt Knife" and "Tablecloth" "Orb of Spheres" (Capital Letters would be the keys for each)

With some difficulty, I've figured out how to obtain the key letters from each item, and I can even add each to a variable per item seperated however I choose.

WHAT I'M TRYING TO DO is run a script that will determine whether or not the letters from these items can be used to obtain the target word. In the example, it works because you use [S]tick [T]ablecloth [A]berforth [B]lunt [S]pheres.

I hope I don't have to explain the difficulty and challenges faced while attempting this?
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #1 on Tue 06 Jul 2010 03:31 PM (UTC)

keyWords = set of key words in input strings
for letter in wordToForm:
  word = find a word in keyWords starting with letter
  if 'word' was found:
    remove 'word' from keyWords
    continue to next letter
    report failure; we can't form wordToForm

VBscript might make this rather annoying due to its container types, but the algorithm isn't really that hard.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum

[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]