Skip to content
Snippets Groups Projects
Commit 6c6a9e2b authored by Piers Williams's avatar Piers Williams
Browse files

Moved code into a package for ease

parent 65ec7112
No related branches found
No related tags found
No related merge requests found
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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment