public Command[] getAgentCommands()
	{
		ArrayList<Agent> agents = level.agents; int agentsSize = level.agents.size();
		
		// make sure every agent has a command planned
		
	
		for (int i=0; i<agentsSize; i++) {
			planForAgent(agents.get(i));
		}
		
		
		if(agents.size() > 1){
		for(TaskDispenser td : taskDispensers){
			td.handleRequests();
		}
		
		
		// solve conflicts per TD
		for (TaskDispenser td : taskDispensers) {
			HashMap<Field, ArrayList<Object>> conflictingObjects = Utils.isConflict(td);
			if (!conflictingObjects.isEmpty())
			{
				Utils.resolveConflicts(level, td, conflictingObjects);
			}
			
			td.shouldMakeRequests( false );

		}
		}
		
		// at this point all agents have a command
		// so we can safely ask for commands
		Command[] cmds = new Command[agentsSize];
		for (int i=0; i<agentsSize; i++) {
			try {
				cmds[i] = agents.get(i).taskQueue.peek().commandQueue.poll();

			} catch (Exception e) {
				cmds[i] = null;
			}
		}
		return cmds;
	}