The film ends in a classic scene, where our protagonist Blondie ("The Good") is part of a Mexican stand-off at Sad Hill Cemetery versus the antagonists Tuco ("The Ugly") and Angel-Eyes ("The Bad").
In the film, Blondie has an ace up his sleeve, so he does not have to consider the rules of this problem, which is a bit unfortunate as they are pretty interesting. The trivial case where each shooter has 100% accuracy, it is clearly never a good idea to shoot first -- whomever you do not shoot will shoot you. Shooting first simply never is a good idea in this scenario. Good thing Blondie cheated, in other words.
However, when accuracy is less than perfect, things get more complex. Instead of crunching the numbers manually, I decided to let machines do my work for me, and wrote a python script to simulate the stand-off.
Assuming Blondie fires first, these are the results, which offered a few surprises
|Simulation of the Sad Hill Cemetary scenario, 1000 samples/accuracy level|
As expected, the high-accuracy scenario means shooting first is a guaranteed way of losing, but if the involved parties are poor marksmen, the rules change. It turns out, if the accuracy of all involved shooters is less than 50%, shooting first is in fact the optimal strategy.
But there's a third domain. If all involved are imperial stormtroopers, with accuracy approaching 0%, it won't matter who fires first; all gunslingers have approximately the same likelihood of surviving, which seems sensible, as the battle will get more drawn out who performed the opening move will play an increasingly smaller role.