Simulated outcomes of phages exposed to biofilms composed of resistant and susceptible cells. (A) Example time series in which biofilms of phage-resistant and phage-susceptible cells are allowed to reach a critical height before introduction of phages. Phages can absorb to resistant cells but cannot amplify within them, and phages that have departed the biofilm—if they do not reinfect within the next time step—are assumed to be removed by fluid advection. Note that the colors for nutrients, bacteria, and phages are graded from light to saturated as a function of the local density of the respective class. For example, black squares contain the maximum local density of phages, whereas gray squares contain fewer than the maximum. d, day. (B) Summary heatmap of the effect of biofilm structure on selection for phage resistance. In the heatmap, simulation outcomes are shown for various degrees of nutrient availability (which controls the baseline host growth rate) and initial resistant strain frequency. Here, both phage mobility and removal rate from the liquid phase are intermediate, and the bacterial fitness cost of phage resistance is 5% of the maximum growth rate (see Fig. S1 and S2 in the supplemental material for extensive exploration of these factors). Resistant cells increase in frequency when initially uncommon (blue squares in heatmap), but when they are initially common, their relative abundance either stays the same (white squares) or decreases (red squares).