Here is a code snippet that calculates the probability of the outcome of a two sided game based on the capability of each side. I used it in my football league simulator program
Could be used in any number of simulators which involve two parties. For equally strong parties, the result is calculated based on equal probability of all three outcomes.
It can be written in hundreds of different ways. Good Luck