lundi 20 novembre 2017

probability and rolling dice; How do I code a random lookup table, or wandering monster table? [on hold]

who knows how to do this? can anyone work out a solution for me? this is my assignment and I'm not sure where to start.

I need to make a "wandering monster table", not sure how to start. I have to allow the user to input a percent chance for each of four situations.

Example:

Probability:..................Encounter:................................Min roll:......................... Max roll:

user says 50%.......user says "dragon" .......................... 0 ..................................49

user says 5% ............ user says "gold" ......................... 50 ............................... 54

user says 20% ........ user says "friends" ...................... 55................................. 74

user says 25% ........ user says "enemies" ................... 75 .................................99

(button that says "generate the table!" which saves all the data to its variables)

(button that rolls the 9 sided dice)

***dice images that say 99*

"You rolled a 99"

You encountered Enemies!

" a certain situation depends on the dice rolled, I also need to put two 10 sided dice on the bottom of the page, thats how you get 99. the dice are simply created using 10 images that range from 0 to 9, and you roll 2 of them. When you roll them, two of the 10 dice images appear) when the user rolls the dice, it says what they landed on below.




Aucun commentaire:

Enregistrer un commentaire