Coding challenge

John and Mary have a six sided non-weighted dice. They want to decide who should start a game an decide that whoever throws the dice and gets 6 should start first. Write some code to find, if Mary throws the dice first, what is the probability that she wins? What about John (throwing second)? Use math.random(1,6) to simulate a dice throw. Note, finding probabilities in this way, requires many, many "trials" of your logic. (Ans: Mary: 6/11, John: 5/11.)

Type your code here:


Lua reference

See your results here: