Advertisement

Help need in AI algorithm.

Started by May 18, 2005 11:18 PM
3 comments, last by DarkThrone 19 years, 8 months ago
Hi, I am DarkThrone I was working in a game IA library, that can be nice if I put my ideas in pratice. First of all, I need help. Suggestions or even pieces of code will be appreciated and colaborators are recognized in future credits. I create a algorithm that uses a binary tree, that I call "Event Handler". Basically, it's a function that calculate iterations and compare results with the setup until a result is reach. It's the start: struct Header{ unsigned int ID; char *label; } struct Object{ struct Object *nObject; Header *ObjHd; <parameters> } I need to figure a simple method to store parameters in this struct so I can use to handle any kind of data(strings,integers or even booleans). It can be a dynamic parameter, so I also use the same struct to store a car info and a person info. If anyone can help, them are wellcome. Thanks.
Thanks for the reply.

I just figured it also, but I need a more flexible handler.

I just tried it out:

struct HandleData{
struct Handledata *nextData;
enum Type = {BOOLEAN, INTEGER, CHAR}
void *Value;
}

struct Node{
Header *hObj;
struct Node *nextNode;
struct Node *InheritedNode;
HandleData *NodeData;
}

but a VOID pointer gets a error in compiling.

I need a way to do data ocuppy less space than possible, even so the process can load thousand of this, and make the Data parameters full dynamic ( ever i try to deallocate data of a node with delete, and put a new value in deallocated space, program and system crashes).

Advertisement
The word you want to google for is "variant datatype". A good implementation is boost::any. If you want key->value look-up for variants, try a std::hash_map<> from boost::any to boost::any (to key anything to anything) or from std::string to boost::any.
enum Bool { True, False, FileNotFound };
thanks.

Well, some can indicate me a good AI tutorial? I want to write a word recognizion library, to a date simulator, as "tokimeki memorial", but some kind of WRITE-YOURSELF-INSTEAD-OF-CHOOSE-A-OPTION.

Some structures of feelings are ready, it simulate anger, happyness, etc... And the relationship is registered and the answer chooses based on it.

Some of good thing to use it's a kind of Dictionary Handler, just as a database file as a binary. Encoding/decoding functions, file management, based on low-level C libraries to avoid bugs. If someone can help, will be appreciated.

This topic is closed to new replies.

Advertisement