resources.println("[Parser] Parsing file: " + file.getAbsolutePath() + "...");
int gene;
Connection newConnection;
Node changingNode;
// for all nodes, columns first
for (int c = 0; c < resources.columns(); c++) {
for (int r = 0; r < resources.rows(); r++) {
// store the changing node
changingNode = chromosome.getNode(r, c);
// for every connection
for (int i = 0; i < resources.arity(); i++) {
// get connection number from the .chr file
gene = in.nextInt();
if (gene < resources.inputs()) {
// connection was an input
newConnection = chromosome.getInput(gene);
} else {
// connection was another node, calculate which from its number
newConnection = chromosome.getNode((gene - resources.inputs()) % resources.rows(),
(gene - resources.inputs()) / resources.rows());
}
changingNode.setConnection(i, newConnection);
}
// set the function, straight indexing should work - this is not entirely
// safe, but it is not viable to check for functionset compatibility
changingNode.setFunction(resources.getFunction(in.nextInt()));
}
}
// outputs
for (int o = 0; o < resources.outputs(); o ++) {