November 9th, 2012, 01:01 PM
So I'm working on a program involving five dice being rolled 3 three times. Whenever I roll a six, I want to keep that die (Like Yahtzee) and continue rolling with the remaining dice. I have however no clue how to code it so that it keeps a six and continues with the remaining dice. Does anyone know how to do that?
November 9th, 2012, 01:49 PM
First off, if you haven't done so already, write a function roll() (or something like that) that takes a variable number of dice, loops through that number of random integers, and returns a list of the results. This will give you the bility to generate an arbitrary number of die rolls on a given throw.
Selecting out the sixes from the returned list is left as an exercise.