Ok, I've (seriously) breifly (no really, Breifly) read a few things on artificial intelligence and nueral nets and some of that other fun stuff. In order to conduct a fun (very uninformed) project I decided to make a program using my comprehension (probably so very wrong).

Here is some of theory behind the game so far:
I have a basic ship class (currently rendered as triangle) that has 6 basic functions, forward, rotate left, rotate right, move forward,move backward , fire, and mutate. These functions are controlled,or rather activated by (my)neural net(of six nodes).

The structure of the class:
Code:
```	class cInvader {
public:

void Fire();
void RotateL(void);
void RotateR(void);
void MoveF();
void MoveB();
void Mutate();
void Think(int node, float energy);
void Think(aiNode *node, float energy);
void FunctionCenter(int func);

void Render();
void NetRender();
private:
float location[3]; // x,y,z
float velocity[3]; // xyz;
float orientation[3]; // x,y,z
int	  kills;
unsigned long int generation;
public:
aiNode aiNet[6];
};```
The net is basicly 6 nodes that share a randomized connection route(created by mutate function). Each node is associated with one of the six functions. Each node has an energy capacity and when reached calls the ship function.

A look at the node structure:
Code:
```	struct aiNode {
float	inLoss; // energy loss from incomming signals
float	outLoss; // energy loss from outgoing signals
float	capacitor; // energy storage
float   energyReq; //
int id;
};```
The way the network works is an energy is introduced to a starting node, and travels through the connections (disapating as it travels) and adds to the capacity of each node.When the node is activated, it fires and resets. This is done repeatedly until the introductory energy is disapated.
[SIde/Related note] currently this makes the network only able to handle one energy input from start to finish. Its not so much real time. Eventually I was thinking of making the network calculations run on seperate threads to the game, as to allow for multiple node immitions and enery imputs in real time.[End side/related note]

The way the net is innitiated is at some point in time an energy is inputed to a starting node (will later be implimented that information about the surrounding will fire different energy to different nodes [ie an enemy ship within a specific range prompts 2 micro joules of energy to node 2--and then disperses through the net] These things will be radar, damage, location, longevity etc) and the energy will travel through the randomized linked nodes firing off nodes appropriatly when enough energy is accumulated.

What I am looking for, is the best way to randomize the linkage between 6 nodes of a net. Every node must be in the net, and every node can only link to one other node. Currently my function seems to work at program start, but when mutate is called later, it seems to go into an infinite loop when trying to re-randomize the net. Any input or ideas on a propper algorythem, or other net structures would be greatly appreciated. Thanks.

btw: heres the current mutate code
Code:
```void cInvader::Mutate() {
for(int i = 0; i < 6; i++) {
}
for( i = 0; i < 6; i++ ) {
int index = 0;
this->aiNet[i].energyReq = (float)(rand()%10)/50;
this->aiNet[i].inLoss = (float)(rand()%1)/10000;
this->aiNet[i].outLoss = (float)(rand()%1)/10000;
this->aiNet[i].capacitor = 0;

index = rand()%10;
index = wrap(0, 5, index);
} else {
continue;
}
/*
if(this->aiNet[index].linked != true && this->aiNet[i] ) {
} else {
continue;
}
*/
}
}
};```
PS. The image attached is what the game currently looks like. I've only got one ship active, and its net (with accumalated vs. required energy) shown on the right portion of the screen. Not much to look at, but its the functionality thats interesting.

2. hmmmm you could use a binary (or more i guess) tree and have the neural net set up that way. at each node it could randomly pick the next node and continue on. you could also randomly add points in 'personality' categories to decide how aggressive the ship is, etc. then depending on the lvl of aggressiveness the ship could decide to travel down the aggressive branch of the tree, blazing in firing crazily. or the passive path and flee in abject terror when an enemy approachs.

not sure if any of that helps... looks pretty cool in my head tho... like a lot of things

3. Code:
`)(rand()%1)`
doesn't like to be truly random. you might want to try something else for randomness.