I have a project in which I need to create a Dice Poker game, also I am VERY new to programming so I am still trying to get my footing when it comes to this. In the game the user rolls 5 dice, then is asked if he/she would like to re-roll any of the dice along with which ones (#'s 1-5). I was able to do the first roll by setting it to an array, but I am completely lost when trying to figure out how to do the re-roll. Any suggestions on how the user can choose which dice to roll again and then having the new numbers replace the older ones? This is the code for the first dice roll.
Shahan Kemanjian wrote:This is the code for the first dice roll...
And therein lies your problem. You've already written code before you've worked out how to solve the problem.
So, my advice: StopCoding (←click), and go back to your problem description:
"In the game the user rolls 5 dice, then is asked if he/she would like to re-roll any of the dice along with which ones (#'s 1-5)."
One tip for you though: Java is an Object-oriented language, so it generally works best when it has objects to work with; but you've equated a die with an int. Now, I can understand why you did that; but it's not really the best start.
This page, although it talks about Strings rather than ints, may help to explain why.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here