I'm new to programming and I'm having an issue trying to implement three dice with three difficulties with a total of 12 dice. So I'm trying to figure out a way to have the three separate difficulties and to have the system randomly choose what difficulties the dice will be. My inspiration came from the dice game called Zombie Dice. Just for some added clarity if this statement is confusing.
I've tried to set it up was three separate arrays and to set the number of these dice that the system can take. The problem I'm having is trying to figure out how I can tell the system, that out of the 12 dice, 5 are of an easy difficulty, 4 are of a medium difficulty and 3 are of a hard difficulty. Since I am still new, I am not sure what would be the best way for me to implement this. I was thinking of making an array that includes all the difficulties and all the dice.
let survivorDiceEasy = [0, 1, 2, 3, 4, 5]
//These integers are just place holders. Once I get the imagines I need to update this to reflect the changes.
let survivorDiceMedium = [0, 1, 2, 3, 4, 5]
//These integers are just place holders. Once I get the imagines I need to update this to reflect the changes.
let survivorDiceHard = [0, 1, 2, 3, 4, 5]
//These integers are just place holders. Once I get the imagines I need to update this to reflect the changes.
let numberOfSurvivorDiceEasy = 5
let numberOfSurvivorDIceMedium = 4
let numberOfSurvivorDiceHard = 3
// Instead of defining a number like this, I can create an array of the total number of dice and randomly choose dice out of the array.
// let totalNumberOfDice = 12
// let totalNumberOfDiceArray = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
// Indices from 0 to 4 can be the easy dice, indices from 5 to 8 can be the medium and indices from 9 to 11 can be the hard dice.
var survivorDiceEasyArray = 0
var survivorDiceMediumArray = 0
var survivorDiceHardArray = 0
So far this is what I have written and I seem to be stuck on how to proceed.
Any help would be greatly appreciated, so I thank you for taking the time to stop on by and to read all of this text.
Aucun commentaire:
Enregistrer un commentaire