# dueling_idiots

dueling_idiots, a MATLAB code which contains the scripts used to illustrate Paul Nahin's "Dueling Idiots".

### Languages:

dueling_idiots is available in a MATLAB version.

### Related Data and Programs:

digital_dice, a MATLAB code which contains the scripts used to illustrate Paul Nahin's "Digital Dice".

will_you_be_alive, a MATLAB code which contains the scripts used to illustrate Paul Nahin's "Will You Be Alive 10 Years From Now?".

### Reference

Paul Nahin,
Dueling Idiots and Other Probability Puzzlers,
Princeton, 2012,
ISBN: 978-0691155005.

### Source Code:

• ash.m, a special case of CHESS using P = Q = 1/3.
• balls.m, simulates a problem involving numbered balls in an urn.
• baseball.m, models a baseball season.
• biased.m, plays odd-man-out with a biased coin.
• binomial.m, computes the binomial coefficient N-choose-K.
• brownian.m, models a Brownian walk in two dimensions.
• bulb.m, analyzes the light bulb problem.
• casino.m, simulates the game "Chuck-a-Luck".
• cc.m, computes the correlation between elements of a random vector.
• chess.m, simulates an N-game chess tournament.
• correlation.m, plots the scatter diagram of (X(I), X(I+J)).
• cpm.m, executes the Critical Path Method.
• esim.m, estimates E by a binning process.
• flycircle.m, models two flies landing at random points in the unit circle.
• flysquare.m, simulates two flies landing at random in the unit square.
• gas.m, simulates the diffusion of a gas.
• generator.m, plots a histogram of 100,000 random values.
• idiots1.m, simulates a Russian Roulette style duel.
• idiots2.m, simulates a duel in which the N-th turn involves N shots.
• kids.m, simulates a family planning problem.
• markov.m, follows a Markov chain process.
• match.m, computes the probablity of a coin flipping match.
• monty.m, simulates the Let's Make a Deal puzzle.
• needle.m, studies a needle dropped onto a table.
• normal.m, displays a histogram of 100,000 normal random numbers.
• odd.m, simulates the game of odd man out.
• onedwalk.m, models a random walk in one dimension.
• onewaytodoit.m, shows how to generate normal random values.
• onion.m, randomly slices the unit interval.
• paths.m, estimates the length of the average walk across a square.
• pert.m, implements the Critical Path Method for a randomized problem.
• pisim.m, estimates PI by sampling points in a square.
• randomsum.m, carries out a process that estimates E.
• spider.m, simulates a spider's random walk on a 2D web.
• stirling1.m, compares the logarithms of n! and Stirling's approximation.
• stirling2.m, compares n! to Stirling's approximation.
• stirling3.m, compares n! and Stirling's approximation.
• theory.m, plots the theoretical distribution for the PATHS problem.
• thief.m, simulates the Thief of Baghdad problem.
• tub.m, optimizes the allocation of search boats for the Unsinkable Tub.
• underdog1.m, estimates the chances of an underdog winning the World Series.
• underdog2.m, estimates the duration of a World Series.
• xplusy.m, creates a histogram of the sum of N random variables.
• xpowery.m, plots the PDF of X^Y.
• xyhisto.m, makes a histogram of X^Y.
• z.m, uses a histogram to approximate the distribution of X/(X-Y).

Last revised on 07 May 2019.