有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java扑克EV计算器:计算手的价值?

我正在尝试编写一个程序,帮助用户为每只手做出正确的EV播放。然而,目前我正在使用卡片价值(即总共两张卡片)来做决定。例如9=9,10=10,j=11,q=12。。。。我希望使用能够进入他们的实际手中,例如ADK(钻石王牌,黑桃之王)。这会更准确,因为它会考虑手的合适价值等。有谁能给我建议,最好的方式纳入这一点?非常感谢!我的cuurent代码在下面

package uk.ac.qub.lectures;

//importing resources (scanner)
import java.util.Scanner;

public class PokeGame {

    public static final int MIN_POSITION = 1;
    public static final int MAX_POSITION = 8;

    public static void main(String[] args) {
        // declaring user position
        int userPosition = 0;
        // setting up scanner
        Scanner scanner = new Scanner(System.in);
        // integer referring to use again or not
        int useAgain = 0;
        // boolean getting valid input for repeat
        boolean repeat = false;

        // declaring number value of each card
        int cards;

        do {

            // getting user position
            do {
                System.out.printf("Please enter position between %d and %d\n",MIN_POSITION, MAX_POSITION);
                userPosition = scanner.nextInt();
            } while ((userPosition < MIN_POSITION)  || (userPosition > MAX_POSITION));
            // getting hand hand strength
            System.out.println("Enter card value");
            cards = scanner.nextInt();

            switch (userPosition) {

            case 1:
            case 2:
                if (cards > 10) {
                    System.out.println("SHOVE");
                } else
                    System.out.println("FOLD");
                break;
            case 3:
            case 4:
            case 5:
                if (cards > 13) {
                    System.out.println("SHOVE");
                } else
                    System.out.println("FOLD");
                break;
            case 6:
            case 7:
            case 8:
                if (cards > 17) {
                    System.out.println("SHOVE");
                } else
                    System.out.println("FOLD");
                break;
            default:
                System.out.println("ENTER VALID POSITION");
            }
            do {

                System.out.println("Do you advice on another Hand?");
                System.out.println("Enter 1 for Yes, Enter 0 for No");
                useAgain = scanner.nextInt();
                if ((useAgain == 1) || (useAgain == 0)) {

                    repeat = false;
                } else {

                    System.out.println("Invalid Input, please enter 1 or 0");
                    repeat = true;
                }
            } while (repeat);
        } while (useAgain != 0);

        // clean up resources
        scanner.close();
    }// method end

}// class end

共 (0) 个答案