사용자가 각 손에 대해 정확한 EV 재생을하는 데 도움이되는 프로그램을 작성하려고합니다. 그러나 분당 내 의사 결정을 기반으로 카드 가치 (즉 총 2 장)를 사용하고 있습니다. 예를 들어, 9 = 9, 10 = 10, j = 11, q = 12 .... 나는이 사용법을 실제 손에 넣을 수 있기를 바랍니다. Adks (다이아몬드의 에이스, 스페이드의 왕). 이것은 손의 적절한 가치를 고려할 때 더 정확할 것입니다. 누군가가 이것을 통합하는 최선의 방법에 대해 조언을 해줄 수 있습니까? 미리 많은 감사드립니다! 내 cuurent 코드는 아래와 같습니다!포커 EV 계산기 : 손 가치 계산?
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
그 userPosition을 추가 잊으하면 해당 사용자가 테이블에 앉아 배치하기 위해서만 의미 (즉 초기 위치, 딜러 등)! 감사! –
프로그래밍과 관련이 없지만 포커와 관련이 없으므로 두 카드의 숫자 차이도 고려해야합니다. 더 멀리 떨어져있는 두 장의 카드가 (2, K)이면 직선 가능성이 작습니다. –
그것은 대답 아니지만, 인 Golder의 제안 : 따르 [CLEAN CODE] [1] 지침 일부입니다 : 는 - 의미있는 이름 와 상수를 사용합니다 - 여러 작은 방법으로 (각 약 5 문) 당신이 암호를 해독하고 메서드의 이름을 올바르게 지정하십시오. - 각 메서드는 하나의 책임 만 있습니다. 더 많은 규칙이 있지만이를 사용하므로 코드를 더 쉽게 읽고 이해할 수 있습니다. [1] : http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 –