Heads represents cats and tails represents dogs. There is two coins because we are checking the probability of two pets. You have to do the experiment to get your set of data, once you get your set of data, you will be able to divide it into the probability for cats or dogs. To change the simulation to generate data for 3 pets, simply add a new coin and category for the new pet. Hope this helps you out!