From 6c6a9e2b1eedb7e1de907239ef273c78115f830d Mon Sep 17 00:00:00 2001
From: Piers <pwillic@essex.ac.uk>
Date: Fri, 12 Jun 2015 09:41:49 +0100
Subject: [PATCH] Moved code into a package for ease

---
 .../{ => Piers}/PiersController.java          | 59 ++++++++++++-------
 1 file changed, 38 insertions(+), 21 deletions(-)
 rename src/battle/controllers/{ => Piers}/PiersController.java (60%)

diff --git a/src/battle/controllers/PiersController.java b/src/battle/controllers/Piers/PiersController.java
similarity index 60%
rename from src/battle/controllers/PiersController.java
rename to src/battle/controllers/Piers/PiersController.java
index 816428f..bedecf3 100644
--- a/src/battle/controllers/PiersController.java
+++ b/src/battle/controllers/Piers/PiersController.java
@@ -1,41 +1,59 @@
-package battle.controllers;
+package battle.controllers.Piers;
 
 import asteroids.Action;
 import battle.BattleController;
-import battle.NeuroShip;
 import battle.SimpleBattle;
 
+import java.util.ArrayList;
 import java.util.Random;
 
 /**
  * Created by pwillic on 11/06/2015.
- *
+ * <p>
  * Features to use for avoidance
- *
- *  1. Distance to enemy - 0 very close, 1 very far
- *  2. Enemy in FL - 0 no, 1 yes
- *  3. Enemy in FR
- *  4. Enemy in BL
- *  5. Enemy in BR
- *
- *  Features to use for shooting
- *  1. Distance to enemy
- *  2. Deviance from dead straight Left - 0.5 no deviance, 0 full left, 1 full right
- *  3. Missiles Remaining
- *
- *  Features to use for aligning
- *  1. Distance to enemy
- *  2. Deviance from enemy
- *  3.
+ * <p>
+ * 1. Distance to enemy - 0 very close, 1 very far
+ * 2. Enemy in FL - 0 no, 1 yes
+ * 3. Enemy in FR
+ * 4. Enemy in BL
+ * 5. Enemy in BR
+ * <p>
+ * Features to use for shooting
+ * 1. Distance to enemy
+ * 2. Deviance from dead straight Left - 0.5 no deviance, 0 full left, 1 full right
+ * 3. Missiles Remaining
+ * <p>
+ * Features to use for aligning
+ * 1. Distance to enemy
+ * 2. Deviance from enemy
+ * 3.
  */
 public class PiersController implements BattleController {
     Neuron tinyBrain;
-
+    int fitness;
 
     public PiersController() {
         tinyBrain = new Neuron(10);
     }
 
+    public static void main(String[] args) {
+        int POPULATION_COUNT = 20;
+        int TERMINATION_SCORE = 500;
+
+        // Learn the controllers
+
+        SimpleBattle battle = new SimpleBattle();
+
+        ArrayList<PiersController> candidates = new ArrayList<>(POPULATION_COUNT);
+        for (int i = 0; i < POPULATION_COUNT; i++) candidates.add(new PiersController());
+
+        // Run the GA?
+        PiersController best = candidates.get(0);
+
+        while (best.fitness < TERMINATION_SCORE){
+
+        }
+    }
 
     @Override
     public Action getAction(SimpleBattle gameStateCopy, int playerId) {
@@ -43,7 +61,6 @@ public class PiersController implements BattleController {
         double[] avoidanceTable = new double[5];
         double[] shootingTable = new double[3];
 
-
         return null;
     }
 }
-- 
GitLab