Condition judgment of while in java

problem description

Nine people play the dice game, each having ten chances to roll two dice at a time (1-6 points of the dice, that is, a random number of 1-6 times)
if the points of dice 1 and dice 2 are equal, then print single and return 1 in detail as shown in the figure

Let"s go back to the previous condition that 9 people play the game, each person has ten opportunities to play dice, each chance to throw two dice, if a person has three strike return values in his ten chances (no more than three), then give that person a little red flower

if these nine people use their 10 chances respectively, the game ends with 3 little red flowers. If less than 3 people restart the game,
the game will not be written. I don"t know how to write the code to restart the game
Note that the use of several functions is fixed
bat: roll dice 1 dice 2 print prompts and return the corresponding value
BatterTakeTurn: whether each player gets Little Safflower or not according to the conditions in the figure. Return true if you meet the conditions for obtaining safflower. Otherwise, return false

.

clipboard.png

the environmental background of the problems and what methods you have tried

related codes

currently completed code

import java.lang.String;
import java.util.Random;
public class Butterup3 {
    public static void  main(String[] args) {
//        array9
        String[] names = {"Amy", "Bob", "Carl", "Diana", "Ed", "Francis", "Gerogia", "Hank", "lzzy"};
        int tune = 0;
        for(int i = 0;i<names.length; iPP) {
            Boolean r =  BatterTakeTurn(names[i]);
            if(r == true) {
                tune = tune+1;
                if(tune ==3) {
                    break;
                }
            }
        }
    }
    public static boolean  BatterTakeTurn(String args) {
        System.out.println(args);
        int StrikeTotal = 0;
        for(int i=0;i<10;iPP){
            int result = bat();
            if(result == -1) {
                StrikeTotal = StrikeTotal+1;
                if(StrikeTotal==3) {
                    System.out.println("Strike out");
                    break;
                }
            }
        }
        return StrikeTotal==3?true:false;

    }
    public static int bat() {
//        java
        Random rand = new Random();
//        1 1-6
        int x = rand.nextInt(6) + 1;
//        2 1-6
        int y = rand.nextInt(6) + 1;
        if(x == 1 && y == 1) {  //121  &&
            System.out.println("Rolled " + x + " " + y + " " + "single");
            return 1;
        }else if (x==2 && y == 2){  //122  &&
            System.out.println("Rolled " + x + " " + y + " " + "double");
            return 2;
        }else if(x == 3 && y == 3) { //123  &&
            System.out.println("Rolled " + x + " " + y + " " + "triple");
            return 3;
        }else if(x==4 && y== 4) {   //124  &&
            System.out.println("Rolled " + x + " " + y + " " + "Home run");
            return 4;
        }else { // 12
            int sum = x + y;//1  2 
            if(sum%2 != 0) { //
                System.out.println("Rolled " + x + " " + y + " " + "Ball");
                return -2;
            }else {// 
                System.out.println("Rolled " + x + " " + y + " " + "Strike");
                return -1;
            }
        }
    }
}

what result do you expect? What is the error message actually seen?

Sep.17,2021

mainly adds the playARound method to represent a round of games.

import java.lang.String;
import java.util.Random;
public class Butterup3 {
    public static void  main(String[] args) {
//        array9
        String[] players = {"Amy", "Bob", "Carl", "Diana", "Ed", "Francis", "Gerogia", "Hank", "lzzy"};
        int tune;
        while(true) {
            System.out.println("");
            tune = playARound(players);
            System.out.println("");
            if(tune < 3) {
                System.out.println("");
            }else {
                System.out.println(""+tune+"");
                break;
            }
        }
    }
    public static int playARound(String[] players) {
        int tune = 0;
        for(int i = 0;i< players.length; iPP) {
            if(BatterTakeTurn(players[i])) {
                tunePP;
            }
        }
        return tune;
    }
    
    public static boolean  BatterTakeTurn(String args) {
        System.out.println(args);
        int StrikeTotal = 0;
        for(int i=0;i<10;iPP){
            int result = bat();
            if(result == -1) {
                StrikeTotal = StrikeTotal+1;
                if(StrikeTotal==3) {
                    System.out.println("Strike out");
                    break;
                }
            }
        }
        return StrikeTotal==3?true:false;

    }
    public static int bat() {
//        java
        Random rand = new Random();
//        1 1-6
        int x = rand.nextInt(6) + 1;
//        2 1-6
        int y = rand.nextInt(6) + 1;
        if(x == 1 && y == 1) {  //121  &&
            System.out.println("Rolled " + x + " " + y + " " + "single");
            return 1;
        }else if (x==2 && y == 2){  //122  &&
            System.out.println("Rolled " + x + " " + y + " " + "double");
            return 2;
        }else if(x == 3 && y == 3) { //123  &&
            System.out.println("Rolled " + x + " " + y + " " + "triple");
            return 3;
        }else if(x==4 && y== 4) {   //124  &&
            System.out.println("Rolled " + x + " " + y + " " + "Home run");
            return 4;
        }else { // 12
            int sum = x + y;//1  2 
            if(sum%2 != 0) { //
                System.out.println("Rolled " + x + " " + y + " " + "Ball");
                return -2;
            }else {// 
                System.out.println("Rolled " + x + " " + y + " " + "Strike");
                return -1;
            }
        }
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4075d-2c510.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4075d-2c510.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?