package eas.users.ocScenarios.oclrss12.gruppe4;
import java.io.File;
import java.util.Random;
import eas.math.geometry.Vector2D;
import eas.plugins.PluginProperties;
import eas.plugins.masterScheduler.AbstractDefaultMaster;
import eas.simulation.ConstantsSimulation;
import eas.simulation.spatial.sim2D.standardAgents.AbstractAgent2D;
import eas.simulation.spatial.sim2D.standardAgents.ObstacleAgent;
import eas.simulation.spatial.sim2D.standardAgents.wandaRobot.WandaAgent;
import eas.simulation.spatial.sim2D.standardEnvironments.WandaEnvironment;
import eas.simulation.spatial.standardBrains.mdle.MDL2eBrain;
import eas.startSetup.ParCollection;
@PluginProperties(pluginIsHidden = true)
public class MoveScheduler extends AbstractDefaultMaster<WandaEnvironment<AbstractAgent2D<?>>> {
/**
*
*/
private static final long serialVersionUID = -5255261238607675853L;
/*
* (non-Javadoc)
*
* @see
* eas.simulation.masterScheduler.AbstractDefaultMaster#generateRunnables
* (eas.startSetup.ParCollection)
*/
@SuppressWarnings("unchecked")
@Override
@PluginProperties(pluginIsHidden=true)
public WandaEnvironment<AbstractAgent2D<?>>[] generateRunnables(
ParCollection params) {
WandaEnvironment<AbstractAgent2D<?>> env = new WandaEnvironment<AbstractAgent2D<?>>(
1, params);
//env.addCollidingAgent(agent, position, angle, scale)
env.addCollidingAgent( //oben
new ObstacleAgent(0, null, null),
new Vector2D(250, -5),
0,
new Vector2D(4, 1));
env.addCollidingAgent( //unten
new ObstacleAgent(1, null, null),
new Vector2D(250, 1200),
0,
new Vector2D(4, 1));
env.addCollidingAgent( //links
new ObstacleAgent(2, null, null),
new Vector2D(-740, 597),
90,
new Vector2D(2.365, 1));
env.addCollidingAgent( //rechts
new ObstacleAgent(3, null, null),
new Vector2D(1240, 597),
90,
new Vector2D(2.365, 1));
env.addCollidingAgent( //"K" links
new ObstacleAgent(4, null, null),
new Vector2D(-540, 597),
90,
new Vector2D(1.5, 1));
env.addCollidingAgent( //"K" unten
new ObstacleAgent(5, null, null),
new Vector2D(-340, 790),
45,
new Vector2D(1, 1));
env.addCollidingAgent( //"K" oben
new ObstacleAgent(5, null, null),
new Vector2D(-340, 410),
135,
new Vector2D(1, 1));
env.addCollidingAgent( //"I"
new ObstacleAgent(4, null, null),
new Vector2D(200, 597),
90,
new Vector2D(1.5, 1));
env.addCollidingAgent( //"T" hoch
new ObstacleAgent(4, null, null),
new Vector2D(700, 615),
90,
new Vector2D(1.45, 1));
env.addCollidingAgent( //"T" quer
new ObstacleAgent(4, null, null),
new Vector2D(700, 240),
0,
new Vector2D(1, 1));
Random rand = new Random(params.getSeed());
for (int i = 0; i < 10; i++) {
WandaAgent agent = new WandaAgent(i, env, params);
agent.implantBrain(new MDL2eBrain<AbstractAgent2D<?>>(agent, new File("eas/users/tolulo/move2.xml")));
env.addCollidingAgent(agent,
new Vector2D(rand.nextInt(1000), rand.nextInt(1000)),
rand.nextInt(360), new Vector2D(0.5,0.5));
}
return new WandaEnvironment[] { env };
}
/* (non-Javadoc)
* @see eas.simulation.masterScheduler.AbstractDefaultMaster#id()
*/
@Override
public String id() {
return ConstantsSimulation.DEFAULT_MASTER_SCHEDULER_ID + "-tolulosBraitenberg";
}
}