From 550caeee11086bd56db69176b3149ddfa160ee30 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Sat, 17 Oct 2015 17:02:24 +0200 Subject: Reverted to a simple decision tree Turns out it's much easier to write a bot by hand with if statements. --- src/brain/neuron.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/brain/neuron.cpp') diff --git a/src/brain/neuron.cpp b/src/brain/neuron.cpp index d1dd338..c7dba2c 100644 --- a/src/brain/neuron.cpp +++ b/src/brain/neuron.cpp @@ -12,7 +12,7 @@ bool Neuron::calculateActivation() double newActivation = 0; for (auto const& link : _inputLinks) { - newActivation += link.weightedActivation(); + newActivation += link.weightedActivation(); } newActivation = sigmoid(newActivation); @@ -26,3 +26,15 @@ void Neuron::addInput(NeuralLink&& link) { _inputLinks.push_back(std::move(link)); } + +bool Neuron::hasInputWithWeight(std::string srcIdentifier, double weight) const +{ + for (auto const& link : _inputLinks) + { + if (link.inputIdentifier() == srcIdentifier && link.weight() == weight) + { + return true; + } + } + return false; +} -- cgit v1.2.3