Word bank/tree

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Word bank/tree

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Use a map.
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Post by Dareltibus »

sorry don't know what it is and how it's work.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post 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 ;)
Post Reply