Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Groo Gadgets on July 02, 2012, 08:35:06 AM

Title: A more advanced word search function using Array Maker?
Post by: Groo Gadgets on July 02, 2012, 08:35:06 AM
Hey guys,

I've been working on a word game using Array Maker and i've hit a wall with the functionality of how I would like to perform a word list lookup.

I've been playing around with Jean's fantastic word match sample that comes with Array Maker and i'd like to extend it's word search function.

Basically i would like to find how many words a single string contains. For example; let's say I have the word CARTS, I would like to have the functionality to search for and store all the words it contains.

So the word CARTS would output the following list of words:
CAR, CART, CARTS, ART, ARTS

Would this be possible using existing actions and states or would it require a new action?

Any help would be great  :-)

Cheers,

Simon
Title: Re: A more advanced word search function using Array Maker?
Post by: jeanfabre on July 02, 2012, 08:55:47 AM
Hi,

 I am no sure I am following.

 the word search is only based on the list provided. but I kind of see what you are after, you want to split "CARTS" into "C" "CA" "CAR" CART" and "CARTS" and match any items in the list right?


 bye,

 Jean
Title: Re: A more advanced word search function using Array Maker?
Post by: Groo Gadgets on July 02, 2012, 09:21:23 AM
Hey Jean,

My word game will let players add to any real words they create. Kind of like what you can do while playing a game of Scrabble.

A simple example would be as follows:
1. In the first turn player creates the word CAR
2. In the second turn the player adds a "T" to the end of the existing word to create CART

I would like to have the functionality for Array Maker to perform a search of the string CART and output all real words it finds within the string. So in this example it would output 3 real words: CAR, ART and CART

I could brute force a function within a state loop so that it checks the range of the first 3 letters in the string, then the last 3 letters, then finally all 4 letters. This would become very tedious as the player creates longer words.

My game grid can have words up to 7 letters in length but where I would really like to get this working is if the player creates a row of 7 random letters the game's word search engine could "extract" real words from it.

For example if the player creates a row of the following letters GFTAXEB the game's word search engine would find and extract two real words: TAX and AXE

I hope this makes things a little clearer  :-)

Cheers,

Simon