## The first set of code plays only one set of games for the
## gambler's ruin problem. It is short and thus easy to de-bug.
## After we have one set of code working, it is easier to modify
## it to do a long loop of sets of games.
p:= 0.5: # initializes the probability of heads = probability you gain $1
x := 10: # initializes the amount of money you have
y := 10: # intitializes the amount of money your opponent has
t := 0: # intializes the number of coin flips that have occurred
broke := 0: # initializes whether you are broke or not
## The following code plays one set of games -
## until you are broke or your opponent is broke ##
while x>0 and x0 and x0 and x