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

Edited 5 Years Ago by writeout: n/a

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");
}

Edited 5 Years Ago by peter_budo: Keep It Clear - Do use code tags when posting any code

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.

This article has been dead for over six months. Start a new discussion instead.