summaryrefslogtreecommitdiffstats
path: root/ai
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2007-06-04 01:35:20 +0000
committerBen Boeckel <MathStuf@gmail.com>2007-06-04 01:35:20 +0000
commit3595239f08f2bc1df32ef22ed6de9bde10ca3384 (patch)
treed9962c84e3a1f19e2da422f9bb49f65c21ada9f6 /ai
parentc9afda3ab74614fb36986f96b7972c082f275eca (diff)
Style cleanup, minor Matrix fixes, duplication validations, Pokemod methods
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@19 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'ai')
-rw-r--r--ai/Layer.cpp4
-rw-r--r--ai/Layer.h2
-rw-r--r--ai/Net.h2
-rw-r--r--ai/Node.cpp6
-rw-r--r--ai/Node.h2
5 files changed, 8 insertions, 8 deletions
diff --git a/ai/Layer.cpp b/ai/Layer.cpp
index 97ba87b6..5ba794a1 100644
--- a/ai/Layer.cpp
+++ b/ai/Layer.cpp
@@ -51,7 +51,7 @@ void PokeGen::NeuralNetwork::Layer::DeleteNode(int n)
void PokeGen::NeuralNetwork::Layer::UpdateBias(int n)
{
if (n < 0)
- bias.push_back((abs(std::rand())%201)/100.0);
+ bias.push_back((abs(std::rand()) % 201) / 100.0);
else if (n < GetNumNodes())
bias.erase(bias.begin() + n);
else
@@ -69,7 +69,7 @@ void PokeGen::NeuralNetwork::Layer::RandomizeWeights()
{
bias.clear();
for (int i = 0; i < child->GetNumNodes(); ++i)
- bias.push_back((abs(std::rand())%201)/100.0);
+ bias.push_back((abs(std::rand()) % 201) / 100.0);
for (int i = 0; i < GetNumNodes(); ++i)
nodes[i].RandomizeWeights();
}
diff --git a/ai/Layer.h b/ai/Layer.h
index c7f6fa4f..22b35c82 100644
--- a/ai/Layer.h
+++ b/ai/Layer.h
@@ -27,7 +27,7 @@
#include <vector>
#include <cstdlib>
#include "Node.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{
diff --git a/ai/Net.h b/ai/Net.h
index 798a05dc..17bbb85f 100644
--- a/ai/Net.h
+++ b/ai/Net.h
@@ -25,7 +25,7 @@
#define __NEURAL_NET__
#include "Layer.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{
diff --git a/ai/Node.cpp b/ai/Node.cpp
index c95d6eae..9fc723d6 100644
--- a/ai/Node.cpp
+++ b/ai/Node.cpp
@@ -40,7 +40,7 @@ void PokeGen::NeuralNetwork::Node::UpdateWeights(int n)
{
if (n < 0)
{
- weights.push_back((abs(std::rand())%201)/100.0);
+ weights.push_back((abs(std::rand()) % 201) / 100.0);
weightChanges.push_back(0);
}
else if (n < ownerLayer->child->GetNumNodes())
@@ -87,7 +87,7 @@ void PokeGen::NeuralNetwork::Node::RandomizeWeights()
weights.clear();
int i = 0;
for (; i < ownerLayer->child->GetNumNodes(); ++i)
- weights.push_back((abs(std::rand())%201)/100.0);
+ weights.push_back((abs(std::rand()) % 201) / 100.0);
weightChanges.clear();
weightChanges.resize(i - 1, 0);
}
@@ -208,5 +208,5 @@ void PokeGen::NeuralNetwork::Node::CalculateValue()
void PokeGen::NeuralNetwork::Node::DumpData(const std::string &f)
{
-
+ // TODO (Ben#1#): Dump NeuralNode data
}
diff --git a/ai/Node.h b/ai/Node.h
index 76f6d55b..35d2cb17 100644
--- a/ai/Node.h
+++ b/ai/Node.h
@@ -29,7 +29,7 @@
#include <cstdlib>
#include <cmath>
#include "Layer.h"
-#include "../pokemod/Xml.h"
+#include "../pokemod/Ini.h"
namespace PokeGen
{