so this program is meant to work as an Evolution simulator. each neuron is taken through some changing process, for now they are just added to, and then whichever Neuron ends up with the largest value will have that value substituted back in as the base value for all the other Neurons once the next Generation plays. This does not happen yet, as I am stuck trying to fix the problem explained below.
at the bottom of the code in NeuronPath, I am having a problem, for whatever reason, Neuron2 always executes, despite its condition in the if statement always being false. Also if you comment The if statement out, it will do the same thing with the next if statement.
ignore the Neuron2 = NeuralCarier. they are commented out for a reason.
#pragma once
//Global_obj_ptr_var holds global info shared between all classes
class Global_obj_ptr_var
{
public:
double NeuralCarier = 0;
//Neurons represent individuals. Their values can me thought of as levels. they all start at level 1
double
Neuron1 = 1,
Neuron2 = 1,
Neuron3 = 1,
Neuron4 = 1,
Neuron5 = 1;
};
class NeuralNet : public Global_obj_ptr_var
{
public:
void NeuronMain();
void NeuronPath();
};
print and prove that it is executing incorrectly ...
what it says:
true if neuron 2 is > 1 or zero result of: (n1 !=0 && n3 !=0 && n4 !=0 && n5!=0)
else false. so if n2 is 2 or more, it will always be true. if n2 is 0 it will always be false. if n2 is 1 it depends. And so on.
sry jonnin could you better illustrate what you meant, what you wrote is a little hard to read.
and to prove that it is printing wrong, let me explain.
it is not printing wrong, what it is doing is right in the case that it should be executing, the problem is that I did not intend for it to do so.
also if this method I am using does not work, how else can I check to find which Neuron is the greatest.
the logic does not match what you said there.
the is greater does NOT carry through
you need to explicitly say that.
if n2> n1 && n2> n3 && n2>n4 && n2 >n5
what you wrote says if n2 > n1 and n3,n4, and n5 are not zero
c++ does not humanize logical statements. worse, it allows quite a bit of nonsense as legal.
if(x) means if x is not zero.
if (x > y && z) means if x > y and z is not zero.
if (x = y) says assign x the value of y and result to true if y was not zero. //youll get a warning here because its usually a typo for == ).