I'm creating a project similar to this which was created by Karl Sims. Based on the paper that Sims published, I understood that in order to create a "brain" for the creature I need to create a sort of neural network, which in this case is a directed node graph. I won't go into detail about the way the entire network works.
I need to creature neurons, which are nodes that receive some input values and produce one other value based on their functions. They can be pointed to, and point to one or more other nodes. Each neuron also has a function it uses to produce its value. The first step in creating the network is to instantiate neurons without pointers, then give each neuron a function, and then point the pointers of the neurons to its inputs (other nodes in the network). My problem is I can't link the function chosen with the number of parameters required.
For example, let's say that neurons can have these 3 functions:
public float Sum2(float a, float b)
{
return a + b;
}
public float Mul3(float a, float b, float c)
{
return a * b * c;
}
public float Threshold(float a){
if(a > 0.5)
return a;
return 0;
}
Somewhere in the code, I need to have a class similar to this:
class NeuronData{
FunctionIdendifier func; // An object that points to one of the functions Sum2, Mul3, or Threshold. Through it I can reach the original method easily.
int numOfInputs;
}
I thought of creating a dictionary where the keys are functions and the values are the parameters amounts, but that seems too complex, and also has room for human error.
Thanks in advance :)