@Override
	public void run() {
		// acquire the neural agent resources
		final String filename = "BasicNeuralAgent.dat";
		ReinforcementAgent neuralAgent;
		try {
			neuralAgent = BasicNeuralAgentFactory.loadAgent(filename);
		} catch (Exception e) {
			LOGGER.info("Generating a new Neural Agent");
			neuralAgent = BasicNeuralAgentFactory.generateAgent(Constants.getInBounds() * 3, 4);
		}
		
		// setup input reader, and the scene
		InputMap imap = null;
		if (Constants.isHumanPlayable)
			imap = new InputMap();
		
		// setup the agents
		Agent[] agents = new Agent[Constants.numAgents];
		for (int i = 0; i < Constants.numAgents; ++i) {
			if (i == 0)
				if (Constants.isHumanPlayable)
					agents[i] = new HumanAgent(imap);
				else
					agents[i] = new RandomAgent();
			else
				agents[i] = neuralAgent.copy();
		}
		
		// setup the environment
		ColorWar colorWar = new ColorWar(agents);
		for (int i = 0; i < agents.length; ++i)
			agents[i].setObserver(colorWar);
		
		// run the iterations
		ColorScene scene = new ColorScene(colorWar, imap);
		for (int i = 0; i < Constants.iterations; ++i) {
			colorWar.reset();
			scene.reset();
			m_engine.setScene(scene);
			m_engine.start();
		}
		
		// finish game - save agent, etc.
		BasicNeuralAgentFactory.saveAgent(neuralAgent, filename);
		
		System.exit(0);
	}