I don't know this keeps repeating "The last person who went lost". I want to try making this repeat the game 3 times so players can plat it 3 times but it won't repeat. Also, when I try my if(enter!=1||enter!=2) stuff keeps repeating its self even when I type in 1 or 2 can someone help me please?
for(d=0;d<3;d++)
{
while(sticks>0) {
System.out.println("Player 1 how many sticks would you like to take? 1 or 2?");
int enter = numScan.nextInt();//this tells us how many they're going to take
sticks=sticks-enter;
if(enter!=1||enter!=2)//this makes it so people who don't enter a right number are forced to replay the program and suffer
{
System.out.println("please run this program again");
}
System.out.println("There are "+sticks+" sticks left!");
System.out.println("Player 2 how many sticks would you like to take? 1 or 2");
System.out.println("Ther are "+sticks+" sticks left!");
int enter2=numScan.nextInt();//this is the second enter
sticks=sticks-enter2;//this will tell us how many sticks are left
if(enter2!=1 || enter2!=2)//this makes it so people who don't enter a right number are forced to replay the program and suffer
{
System.out.println("please run this program again");
}
System.out.println("Player 1 how many sticks would you like to take? 1 or 2?");
int enter3=numScan.nextInt();//this is the second enter
sticks=sticks-enter3;//this will tell us how many sticks are left
System.out.println("There are "+sticks+" sticks left!");
}
if(sticks<0||sticks==0)
{
System.out.println("The last player who went lost!");
}
}
}
}