Hello forum,

I want to write a simple code of two dices rolling for two players. The players can roll as many times as they want per turn. If they are matching numbers, the total is zero. If a person passes, it is passed on to the next player. Please reply for clarification. Currently i have this.

int1=(int) (Math.random()*6) +1;
int2=(int) (Math.random()*6) +1;
intplayer1total=int1+int2;

A player should be able to pass and the points collected will be added to their total. First to get to 100 win! Thank you

Recommended Answers

All 5 Replies

You're going to have to show more effort than that if you expect any help.

Ask specific questions about the parts you are struggling with.

ok so i have

con.println (dice1 and dice2 which gives me the total)

i need help on having two player turns and if the player says pass, the total is added. Once a player's total has reached 100 the game stops.

int1=(int) (Math.random()*6) +1;
int2=(int) (Math.random()*6) +1;
intplayer1total=int1+int2;

if (int1==int2){
con.println ("Your total is now zero");
}

You really should at least attempt to come up with a solution yourself, this is a help forum, not a do my work for me forum.

You clearly have some programming knowledge, so think about it as a problem solving exercise, its simple enough, then implement it with programming.

yes i have some code but the problem is to loop the cycle and implement a point system for both players

Exactly. Problem is to "loop" the cycle, you know this, yet I see no loops in your code, you could easily do that yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.