java dice game issues -fast please

The thing here, is that you are limiting the number of time a dice can be rolled. In your code, each player roll the time 10 times max, which mean that if they score a low on every roll, they will never reach 100.
What you want to do is to use a while loop that will run the same code until a condition is reached.
Here is the skeleton, i’ll let you figure out the rest 😉

while( no player reached a score of 100 ) {
    player 1 roll the dice
    add the result to player 1 score
    player 2 roll the dice
    add the result to player 2 score

Note that this kind of question isn’t well received on this site. What you need to do is understand what part of your code you can’t get to work. Posting the assignment will only get you negative votes (especially with the “fast please” in the title) and end up with your question being deleted. try to change the title to something like Simulate dice game between two player and to rewrite the question.

Browse More Popular Posts

Leave a Comment