- I created a ComboPlayer.java agent. It sucks and doesn't really work, but I created it. Now I'm putting it down to work on other things.

This commit is contained in:
Marshall
2012-04-29 20:54:34 -04:00
parent e012f17b33
commit 8de42a3562
13 changed files with 239 additions and 83 deletions

View File

@@ -134,6 +134,10 @@ public class PlayerModel implements Serializable {
public Node[] getOutputNodes(boolean[] input) {
if (input.length == inputNode.length) {
for (int i = 0; i < input.length; i++) {
inputNode[i].setStimulation(input[i]);
}
return outputNode;
}
@@ -203,12 +207,13 @@ public class PlayerModel implements Serializable {
}
}
public void train(boolean[] boardState, boolean[] example) {
getOutputNodes(boardState);
public void train(boolean[] example) {
boolean[] hold = getOutputActivations();
System.out.println("TRAIN");
if (example.length == outputNode.length) {
for (int i = 0; i < outputNode.length; i++) {
outputNode[i].learn(example[i]);
outputNode[i].learn(example[i] == hold[i]);
}
}
}
@@ -216,4 +221,14 @@ public class PlayerModel implements Serializable {
private int getHighScore() {
return getHighScores()[0];
}
private boolean[] getOutputActivations() {
boolean[] acts = new boolean[outputNode.length];
for (int i = 0; i < acts.length; i++) {
acts[i] = outputNode[i].axon();
}
return acts;
}
}

View File

@@ -9,7 +9,7 @@ public class SigmoidNode implements Node {
private static final long serialVersionUID = 1L;
// Training rate.
private final double A = .15;
private final double A = .05;
private final Hashtable<Node, Double> dendrites = new Hashtable<Node, Double>();
@@ -36,6 +36,8 @@ public class SigmoidNode implements Node {
n.learn(correct);
}
}
System.out.println(strength());
}
@Override