playMaker

Author Topic: Anagrams (find all words that can be made from this one) [Solved]  (Read 998 times)

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
I have a the main list, and have a temp list the temp list would be sorted alphabetically.
 
Main list      Temp list
Bats            Bstu
Stub            Bstu
Buts            Bstu

If I search the temp list for bstu I would get all the words bstu could make but I’d need to sort every line of the main list, break it apart, sort it, out it back together in another list to compare against.

I thought of using a Hash Table but the keys cannot be the same BSTU.
Post modified for Anagram only.

« Last Edit: November 20, 2020, 03:21:08 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Remove a character from a string - Regex maybe?
« Reply #1 on: November 18, 2020, 10:33:32 AM »
Hi.
You could use String Replace. and replace with "" (nothing)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Remove a character from a string - Regex maybe?
« Reply #2 on: November 20, 2020, 05:46:47 AM »
Hi.
Maybe using a xml here would be useful.

for example you can set a 'Category' "bstu"
and in the category have the words :
Bats
Stub
Buts

Then @runtime you could create hashtables

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Remove a character from a string - Regex maybe?
« Reply #3 on: November 20, 2020, 06:34:34 AM »
Thanks djaydino!
Have I said how much I love playmaker!!! This is one amazing tool

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Remove a character from a string - Regex maybe?
« Reply #4 on: November 20, 2020, 10:53:48 AM »
Solved :) and Doh... I was thinking backwards, for the anagram solution:

Create a hash table proxy, the key would be the word that is alphabetized, then the string of words (would be whats contained in that key) Example:

Key: Whats contained (use spaces in-between words)
acts: cast cats
bust: buts stub tubs

Then I did a Hash Table Contains Key (once the user submits their word I'll break it apart, then sort it, then check if the table contains the key)

If the key is found the next state would have the Hash Table Get to store the result of the string from the key (stringHolder), then finally do a Split Text To Array List (which would be a new array list proxy Or this String (stringHolder), Split  (Space),
now every word that can be made up from those words  will be in this array list proxy that I can do stuff with :)

I wonder if there is a program out there that can sort my dictionary (each character of a line alphabetically) to use for the above purpose so I don't have to do it by hand  :P
« Last Edit: November 20, 2020, 03:11:56 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool