-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stratégiák osztályokba szervezése előkészítve. A különböző játékállások (preflop, flop, turn, river) stratégiái külön osztályt kapnak, itt kellene meghatározni majd a tétet.
- Loading branch information
Showing
8 changed files
with
363 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/org/leanpoker/player/strategies/FlopStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.leanpoker.player.strategies; | ||
|
||
/** | ||
* | ||
* @author imate | ||
*/ | ||
public class FlopStrategy extends Strategy { | ||
|
||
@Override | ||
protected int calcRoyalFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraightFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcPoker() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcFull() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int callFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraight() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcDrill() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcTwoPair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcOnePair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcHighCard() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/org/leanpoker/player/strategies/PreFlopStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.leanpoker.player.strategies; | ||
|
||
/** | ||
* | ||
* @author imate | ||
*/ | ||
public class PreFlopStrategy extends Strategy { | ||
|
||
@Override | ||
protected int calcRoyalFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraightFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcPoker() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcFull() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int callFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraight() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcDrill() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcTwoPair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcOnePair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcHighCard() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/org/leanpoker/player/strategies/RiverStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.leanpoker.player.strategies; | ||
|
||
/** | ||
* | ||
* @author imate | ||
*/ | ||
public class RiverStrategy extends Strategy{ | ||
|
||
@Override | ||
protected int calcRoyalFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraightFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcPoker() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcFull() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int callFlush() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcStraight() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcDrill() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcTwoPair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcOnePair() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
@Override | ||
protected int calcHighCard() { | ||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. | ||
} | ||
|
||
} |
98 changes: 98 additions & 0 deletions
98
src/main/java/org/leanpoker/player/strategies/Strategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package org.leanpoker.player.strategies; | ||
|
||
import com.wcs.poker.gamestate.GameState; | ||
import org.leanpoker.player.checkCards.CheckResult; | ||
import org.leanpoker.player.checkCards.Hand; | ||
import org.leanpoker.player.checkCards.HandChecker; | ||
|
||
/** | ||
* | ||
* @author imate | ||
*/ | ||
public abstract class Strategy { | ||
|
||
protected Hand hand; | ||
protected String highRank1; | ||
protected String highRank2; | ||
protected int myCardsOfHand; | ||
protected GameState gameState; | ||
|
||
public int calculateBet(GameState gameState) { | ||
int bet = 0; | ||
HandChecker handChecker = new HandChecker(); | ||
CheckResult result = handChecker.getResult(gameState); | ||
this.hand = result.getHand(); | ||
this.highRank1 = result.getHighRank1(); | ||
this.highRank2 = result.getHighRank2(); | ||
this.myCardsOfHand = result.getMyCardsOfHand(); | ||
|
||
switch (hand) { | ||
case ROYAL_FLUSH: | ||
bet = calcRoyalFlush(); | ||
break; | ||
|
||
case STRAIGH_FLUSH: | ||
bet = calcStraightFlush(); | ||
break; | ||
|
||
case POKER: | ||
bet = calcPoker(); | ||
break; | ||
|
||
case FULL: | ||
bet = calcFull(); | ||
break; | ||
|
||
case FLUSH: | ||
bet = callFlush(); | ||
break; | ||
|
||
case STRAIGHT: | ||
bet = calcStraight(); | ||
break; | ||
|
||
case DRILL: | ||
bet = calcDrill(); | ||
break; | ||
|
||
case TWO_PAIR: | ||
bet = calcTwoPair(); | ||
break; | ||
|
||
case ONE_PAIR: | ||
bet = calcOnePair(); | ||
break; | ||
|
||
case HIGH_CARD: | ||
bet = calcHighCard(); | ||
|
||
} | ||
|
||
return bet; | ||
} | ||
|
||
protected abstract int calcRoyalFlush(); | ||
|
||
protected abstract int calcStraightFlush(); | ||
|
||
protected abstract int calcPoker(); | ||
|
||
protected abstract int calcFull(); | ||
|
||
protected abstract int callFlush(); | ||
|
||
protected abstract int calcStraight(); | ||
|
||
protected abstract int calcDrill(); | ||
|
||
protected abstract int calcTwoPair(); | ||
|
||
protected abstract int calcOnePair(); | ||
|
||
protected abstract int calcHighCard(); | ||
} |
Oops, something went wrong.
hu, na várjunk csak, szóval úgy állapítod meg, hogy ez érvényes-e, hogy lefuttattsz mindent, majd ha nem null, akkor jó, s utána újból elkéred a getResult-ot... azaz kétszer meg végig az algoritmus... hm... ez biztos megfontolt lépés volt? :)