protected <A extends Actor> Action getAction(A a) {
		Set<Action> actions = a.actions();
		Agent<A> agent = getAgent(a);
		if (actions.size() >= 0 && agent != null) {
			Action choice = agent.choose(a, Collections.unmodifiableSet(actions));
			// If the agent returns a malicious Action, using
			// equals() or hashCode() to confirm it was one of the
			// available choices may allow it to slip through
			// the cracks. Thus, we perform reference comparisons:
			if (choice == null) { return null; }
			for(Action action : actions) {
				if (action == choice) { return action; }
			}
			throw new Error("Agent selected an invalid choice.");
		}
		return Groups.first(actions);
	}