Commit d5abaee3 authored by Yann Ramusat's avatar Yann Ramusat
Browse files

New package for the different kinds of AIs.

parent 18b4f6ec
package artificial_intelligence;
import artificial_intelligence.AIs.AI_Behaviour;
import core.gamestate.GameContent;
import core.relayer.Relayer;
......@@ -8,7 +9,7 @@ import java.util.ArrayList;
/**
* Created by yann on 30/12/15.
*
* A part of the code is inspired by the class AIControler implemented by Arnaud Guerquin.
* A part of this code (killAll and startAll) is inspired by the class AIControler implemented by Arnaud Guerquin.
*/
public class AI_Controler {
......@@ -41,8 +42,12 @@ public class AI_Controler {
/*** FACTORY PART ***/
public static void add(GameContent gameContent, Relayer dmr) {
AI_Entity ai=new AI_Entity(gameContent,dmr);
public static void add(GameContent gameContent, Relayer dmr, AI_Behaviour type) {
AI_Entity ai = null;
switch(type) {
case DEFAULT:
ai = new AI_Entity(gameContent,dmr);
}
list.add(ai);
}
}
......@@ -18,37 +18,18 @@ import static java.lang.Math.abs;
* This class provide a functional AI working on an independant thread.
* Please instanciate the class correctly an then call start() function on this.
*
* TODO All other groups will have to securize their classes with synchronized to avoid concurrency.
* TODO This class will be abstract.
*/
public class AI_Entity extends Thread {
/* Extern information */
private Map map;
//TODO The three following objects are redundant. It's because the AI works with different version of the game
//TODO and the final version is not yet known.
//TODO This will be fixed when other groups will be sure of the type of the objects they will use.
private GameState gameState;
// to have direct access to the map
private Map map;
private Relayer relayer;
//boolean to stop the thread
private boolean endThread;
/* Intern information */
/**
* Instanciate an autonomous AI of indicated type given as context a Map, a GameState and a Relayer to contact.
*
* This use the core's classes.
*
* @param Map the actual map of the game.
* @param GameState the gamestate of the game.
* @param Relayer the relayer to contact.
*/
AI_Entity(Map map, GameState gameState, Relayer relayer) {
this.map = map;
this.gameState = gameState;
this.relayer = relayer;
}
private boolean endThread;
/**
* Instanciate an autonomous AI of indicated type given as context a GameContent and a Relayer to contact.
......
package artificial_intelligence;
package artificial_intelligence.AIs;
/**
* Created by yann on 30/12/15.
*/
public enum AI_Behaviour {
DEFAULT;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment