private void trainUnit(BuildRequest request) {
		UnitType unitToBuild = request.getUnit();

		List<BuildQueue> queues = new ArrayList<BuildQueue>();
		for (BuildQueue building : buildings) {
			// System.out.println("Can " + building.getBuilding().getType()
			// + " train " + unitToBuild + "? "
			// + building.canBuild(unitToBuild));
			if (building.canBuild(unitToBuild)) {
				queues.add(building);
			}
		}
		if (!queues.isEmpty()) {
			Collections.sort(queues);
			StringBuilder queueBuildings = new StringBuilder();
			for (BuildQueue queue : queues) {
				queueBuildings.append(queue.getBuilding().getType() + ", ");
			}
			BuildQueue queue = queues.get(0);

			queue.add(unitToBuild);

			startedMinerals += request.getUnit().mineralPrice();
			startedGas += request.getUnit().gasPrice();

			startedRequests.add(new StartedBuildRequest(request, queue
					.getBuilding()));
			pendingRequests.remove(request);
			return;
		}

		// Couldn't find a building that we registered, fall back
		// to search through all units.
		System.out.println("FAILED to find building for " + unitToBuild);
		buildFailures += 1;
		// for (Unit unit : self.getUnits()) {
		// if (unit.train(unitToBuild)) {
		// startedRequests.add(new StartedBuildRequest(request, unit));
		// pendingRequests.remove(request);
		// break;
		// }
		// }
		return;
	}