Skip to content

Commit

Permalink
#9 Tétek meghatározása
Browse files Browse the repository at this point in the history
csiszolgatás
  • Loading branch information
sztomi1994 committed Mar 24, 2015
1 parent 3c73df0 commit 0817fd4
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/wcs/poker/gamestate/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static List<String> getBigRank() {
@Expose
private String suit;

private static final List<String> bigRank = Arrays.asList("10", "J", "Q", "K", "A");
private static final List<String> bigRank = Arrays.asList("9","10", "J", "Q", "K", "A");

public Card(String rank, String suit) {
this.rank = rank;
Expand Down
112 changes: 67 additions & 45 deletions src/main/java/org/leanpoker/player/CheckConditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
public class CheckConditions {

private int limit = 500;
private int bet;
private GameState gameState;
private List<Card> allCards = new ArrayList<>();
Expand All @@ -23,7 +24,7 @@ public CheckConditions(GameState gameState) {
}

public int check() {

bet = 0;
if (gameState.getCommunityCards().isEmpty()) {
preFlop();
} else {
Expand All @@ -33,34 +34,47 @@ public int check() {
}

private void preFlop() {
bet = gameState.getCall();
List<Card> cards = gameState.requestActHoleCards();

if (isTwoBigCard(cards)) {
if (gameState.requestBigBlind() <= 50) {
bet += gameState.requestBigBlind() * 2;
} else {
bet += 100;
}
}
if (isPair(cards)) {
if (gameState.requestBigBlind() <= 50) {
bet += gameState.requestBigBlind() * 2;
} else {
bet += 100;
}
}
if (isAceOrKingPair(cards)) {
bet = allIn();
}
HandChecker handChecker = new HandChecker();
CheckResult checkResult = handChecker.getResult(gameState);
Hand hand = checkResult.getHand();
String highRank1 = checkResult.getHighRank1();

if (isSHITuation(cards)) {
bet = 0;
}
switch (hand) {

case ONE_PAIR:
if (Card.getBigRank().contains(highRank1)) {
bet = gameState.getCall();
} else {
if (allIn() > limit) {
bet = gameState.getCall();
} else {
bet = 0;
}
}
break;
case HIGH_CARD:
if (Card.getBigRank().contains(highRank1)) {
if (gameState.getCall() < 150) {
if (allIn() > limit) {
bet = gameState.getCall();
} else {
bet = 0;
}

} else {
bet = 0;
}

if (bet == 0 && gameState.areWeBlind()) {
} else {
bet = 0;
}
break;

}
if (bet == 0 && gameState.areWeBlind() && gameState.getCall() <= gameState.requestBigBlind()) {
bet = gameState.getCall();
}
System.out.println("bet:"+bet);
}

private void afterPreFlop() {
Expand All @@ -73,10 +87,10 @@ private void afterPreFlop() {
switch (hand) {
case ROYAL_FLUSH:
if (isFlop()) {
raising(gameState.getSmallBlind()*2);
raising(gameState.getSmallBlind() * 2);
}
if (isTurn()) {
raising(gameState.getSmallBlind()*3);
raising(gameState.getSmallBlind() * 3);
}
if (isRiver()) {
raising(allIn());
Expand All @@ -86,10 +100,10 @@ private void afterPreFlop() {

case STRAIGH_FLUSH:
if (isFlop()) {
raising(gameState.getSmallBlind()*2);
raising(gameState.getSmallBlind() * 2);
}
if (isTurn()) {
raising(gameState.getSmallBlind()*3);
raising(gameState.getSmallBlind() * 3);
}
if (isRiver()) {
raising(allIn());
Expand All @@ -99,10 +113,10 @@ private void afterPreFlop() {
case POKER:

if (isFlop()) {
raising(gameState.getSmallBlind()*2);
raising(gameState.getSmallBlind() * 2);
}
if (isTurn()) {
raising(gameState.getSmallBlind()*3);
raising(gameState.getSmallBlind() * 3);
}
if (isRiver()) {
raising(allIn());
Expand All @@ -111,10 +125,10 @@ private void afterPreFlop() {

case FULL:
if (isFlop()) {
raising(gameState.getSmallBlind()*2);
raising(gameState.getSmallBlind() * 2);
}
if (isTurn()) {
raising(gameState.getSmallBlind()*3);
raising(gameState.getSmallBlind() * 3);
}
if (isRiver()) {
raising(allIn());
Expand Down Expand Up @@ -219,46 +233,53 @@ private void afterPreFlop() {
break;

case ONE_PAIR:

if (Card.getBigRank().contains(highRank1)) {
if (isFlop()) {
if (allIn() > 500 && gameState.getMinimumBet() < 200) {
gameState.getCall();
if (isFlop()) {

if (allIn() > limit && gameState.getCall() < 200) {
bet = gameState.getCall();
} else {
bet = 0;
}
}
if (isTurn()) {
if (allIn() > 500 && gameState.getMinimumBet() < 150) {
gameState.getCall();

if (allIn() > limit && gameState.getCall() < 150) {
bet = gameState.getCall();
} else {
bet = 0;
}
}
if (isRiver()) {
if (allIn() > 500 && gameState.getMinimumBet() < 150) {
gameState.getCall();

System.out.println("allin: " + allIn() + "call: " + gameState.getCall());
if (allIn() > limit && gameState.getCall() < 150) {
bet = gameState.getCall();
System.out.println("true");
} else {
System.out.println("false");
bet = 0;
}
}

} else {
if (isFlop()) {
if (allIn() > 500 && gameState.getMinimumBet() < 100) {
gameState.getCall();
if (allIn() > limit && gameState.getCall() < 100) {
bet = gameState.getCall();
} else {
bet = 0;
}
}
if (isTurn()) {
if (allIn() > 500 && gameState.getMinimumBet() < 100) {
gameState.getCall();
if (allIn() > limit && gameState.getCall() < 100) {
bet = gameState.getCall();
} else {
bet = 0;
}
}
if (isRiver()) {
bet=0;
bet = 0;
}
}

Expand All @@ -267,6 +288,7 @@ private void afterPreFlop() {
case HIGH_CARD:
bet = 0;
}
System.out.println("bet:"+bet);
}

private boolean isFlop() {
Expand Down

0 comments on commit 0817fd4

Please sign in to comment.