Page 1 of 1

Word bank/tree

Posted: Wed Mar 09, 2011 11:56 am
by Dareltibus
is there any way to organize words.. (well i must call them tokens)
in a tree?

for example if i want to find a scene node wich as the name "scenenode1023" i have to iterate and check strings until i find the scene node with this name

Does exist any opensource (possibly zlib) implementation of a tree that allows to organize words and tokens for a linear and fast find?

for example check first character . "s"

actually the tree has only 20 words stored

15 of them start with the "s" character.

5 of them start with the "a" character.

then next characters are checked because all the words stored has the same characters

"ceneNode"

after that it looks for the number character "1" and it finds that there is only one word remaining so now it can stop search or just control the remaining characters "023" for reduce user errors.

after that the scene node is returned. (i think i must use template and dynamic_casting sometimes)

I think that every script language and compiler/parser have something similiar implemented. I want to do the same for my game

Posted: Wed Mar 09, 2011 12:07 pm
by hybrid
Use a map.

Posted: Wed Mar 09, 2011 12:27 pm
by Dareltibus
sorry don't know what it is and how it's work.

Posted: Wed Mar 09, 2011 12:37 pm
by Radikalizm
Dareltibus wrote:sorry don't know what it is and how it's work.
Maps are pretty common objects when programming in C++, irrlicht provides an implementation in the core namespace

You can find lots of tutorials online on how to create and use maps ;)