(A) The model bacteria’s “genotype” consists of a toxin production “gene”, a resistance “gene”, a toxin production rate πT and a response threshold θ. Bacteria regulating their toxin production and/or resistance only express these genes if the local concentration of the density cue exceeds the cell’s response threshold. Expression of the toxin, resistance, and response to the cue come at a fitness cost. (B) The model consists of three coupled 2D lattices, which hold the bacteria, the density cue concentration and the toxin concentration. Bacteria locally compete for unoccupied space to reproduce. All cells have a natural death rate. For cells that are not resistant the death rate increases linearly with the local toxin concentration. All bacteria produce the cue, while the toxin is produced only by bacteria that express their toxin gene. The toxin and density cue diffuse and are degraded at fixed rates.