private Vehicle createRandomVehicle(List<Cell> possibleLocations, Direction dir, int length) {
		int numIterations = 0;
		// limit iterations to prevent infinite loop if conditions cannot possibly be met
		while (numIterations < 1000) {	
			// generate random r,g,b values for vehicle color
			int red = rand.nextInt(256), green = rand.nextInt(256), blue = rand.nextInt(256);
			// prevent the color from being too gray which would blend in with the background
			while (red - green < 20 && red - blue < 20)
			{
				red = rand.nextInt(256); green = rand.nextInt(256); blue = rand.nextInt(256);
			}

			// if invalid length, generate random length
			if (length < MIN_CAR_LENGTH)
				length = rand.nextInt(MAX_CAR_LENGTH - MIN_CAR_LENGTH + 1) + MIN_CAR_LENGTH;

			// create the random vehicle
			Vehicle newCar = new Vehicle(
					possibleLocations.get(rand.nextInt(possibleLocations.size())), 
					length,
					new Color(red, green, blue), 
					dir);

			// check all of the cells underneath vehicle to make sure they are unoccupied and on the board
			boolean locationValid = true;
			List<Cell> vehicleCells = getVehicleCells(newCar);
			for(int j = 0; j < vehicleCells.size(); j++) {
				Cell vehicleCell = vehicleCells.get(j);
				if (vehicleCell == null || vehicleCell.isOccupied() || vehicleCell.getRow() == exitCell().getRow()) {
					// this cell already has a vehicle over it, location is not valid
					locationValid = false;
					break;
				}
			}
			if (locationValid){
				// if none of the cells are occupied then location is valid
				return newCar;
			}
			numIterations++;
		}
		return null;
	}