Skip to content

Commit

Permalink
Merge pull request #11 from evolutionsoftswiss/develop
Browse files Browse the repository at this point in the history
Update master version 0.2.2
  • Loading branch information
evolutionsoftswiss authored Oct 24, 2021
2 parents f0ae55c + aba49e4 commit de0521e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 16 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Features
* Converts pokernow.club csv files to Pokerstars hand history file text format

### Known Limitations
* Only cash games and no tournaments are yet supported
* Player names containing parantheses '(' or ')' are not supported without mapping in name-mappings.properties

Quick Start
Expand All @@ -17,10 +18,10 @@ You need a more or less recent Java SE Runtime Environment to run the released p

For a quick start you can unzip the release version (without subdirectory, but directly all three files) in a folder where you've already got one or more csv's from pokernow.club.

Execute from the directory with containing 'handhistory-converter-0.2.1-jar-with-dependencies.jar' and the two properties files:
Execute from the directory with containing 'handhistory-converter-0.2.2-jar-with-dependencies.jar' and the two properties files:

```
java -jar handhistory-converter-0.2.1-jar-with-dependencies.jar
java -jar handhistory-converter-0.2.2-jar-with-dependencies.jar
```

The csv files from pokernow.club in the directory should then get converted.
Expand Down
2 changes: 1 addition & 1 deletion conversion.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ yourUniqueName = yourUniqueName
# Which of the supported game types are converted, true ones get converted false ones are skipped
convertOmahaHiHands = true
convertOmahaHiLoHands = true
convertTexasHands = false
convertTexasHands = true

# Amount factor of reduction of bet sizes, can be used to support Hold'em Manager Micro Stakes
# An example would be converting a pokernow 0.5 / 1 Blind game to $0.05/$0.1 by using 10 instead of 1 here
Expand Down
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.evolutionsoft.poker.pokernow</groupId>
<artifactId>handhistory-converter</artifactId>
<version>0.2.1</version>
<version>0.2.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ private PokernowConstants() {

public static final String BUTTON_PREFIX = "dealer: ";
public static final int BUTTON_PREFIX_LENGTH = BUTTON_PREFIX.length();


public static final String ANTE_PREFIX = " posts an ante of ";
public static final String SMALL_BLIND_PREFIX = " posts a small blind of ";
public static final String BIG_BLIND_PREFIX = " posts a big blind of ";
public static final String STRADDLE_PREFIX = " posts a straddle of";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PokernowSingleHandConverter {

String lastButtonPlayerName = StringUtils.EMPTY;
String lastButtonPlayerSeat = StringUtils.EMPTY;

double smallBlindAmount = 1;
double bigBlindAmount = 1;
double straddleAmount = 2;
Expand Down Expand Up @@ -69,7 +69,7 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
String gameType = singleHandHistoryLine.substring(
singleHandHistoryLine.indexOf('(') + 1, singleHandHistoryLine.indexOf(')'));
String timeString = singleHandHistoryLine.substring(
singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.indexOf('.'));
singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.lastIndexOf('.'));
timeString = timeString.replace("-", FORWARD_SLASH);
timeString = timeString.replace(TIME_PREFIX, StringUtils.SPACE);
String pokerstarsHandLine1 = POKER_STARS_HAND + handIdPrefix + handNumber + DOUBLE_POINT + StringUtils.SPACE +
Expand Down Expand Up @@ -133,6 +133,21 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws

singleHandHistoryLine = bufferedReader.readLine();
}

String anteLines = StringUtils.EMPTY;
while (singleHandHistoryLine.contains(ANTE_PREFIX)) {

singleHandHistoryLine = singleHandHistoryLine.replace(AND_GO_ALL_IN + StringUtils.SPACE, StringUtils.EMPTY);
String anteLine = singleHandHistoryLine.
replaceAll(ANTE_PREFIX + ONE_OR_MORE_DIGITS_GROUP_REGEX, ": posts the ante \\$" + FIRST_AND_SECOND_REGEX_GROUP_MATCH);

anteLine = ConversionUtils.stripDateAndEntryOrderFromCsv(anteLine);

anteLines += anteLine + System.lineSeparator();

singleHandHistoryLine = bufferedReader.readLine();

}

int indexOfSmallBlindPoster = singleHandHistoryLine.indexOf(SMALL_BLIND_PREFIX);
String smallBlindLine = StringUtils.EMPTY;
Expand Down Expand Up @@ -206,6 +221,12 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
singleHandHistoryLine = bufferedReader.readLine();
}

if (!anteLines.isEmpty()) {

convertedSingleHandHistory += anteLines;

}

if (!smallBlindLine.isEmpty()) {

convertedSingleHandHistory += smallBlindLine + System.lineSeparator();
Expand All @@ -227,9 +248,15 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
if (!missingBigBlindLine.isEmpty()) {

convertedSingleHandHistory += missingBigBlindLine + System.lineSeparator();
}
}

convertedSingleHandHistory += HOLE_CARDS;

if (this.readYourHoleCards && !this.yourHoleCards.isEmpty()) {

convertedSingleHandHistory += DEALT_TO_HERO + this.yourUniqueName +
StringUtils.SPACE + yourHoleCards + System.lineSeparator();
}

String endBoard = StringUtils.EMPTY;

Expand Down Expand Up @@ -288,12 +315,6 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws

} while (null != singleHandHistoryLine && !singleHandHistoryLine.contains(COLLECTED));

if (this.readYourHoleCards && !this.yourHoleCards.isEmpty()) {

convertedSingleHandHistory += this.yourUniqueName + DOUBLE_POINT +
SHOWS_ACTION + yourHoleCards + System.lineSeparator();
}

convertedSingleHandHistory += SHOWDOWN;

List<String> winningAmounts = new ArrayList<>();
Expand Down Expand Up @@ -453,7 +474,7 @@ String handleShowCardsAction(String showdownAction) {
String showedHand;
showedHand = showdownAction.substring(
showdownAction.indexOf(SHOWS_ACTION) + SHOWS_ACTION.length(),
showdownAction.indexOf('.'));
showdownAction.indexOf('.', showdownAction.indexOf(SHOWS_ACTION)));
showedHand = OPEN_BRACKET + showedHand + CLOSED_BRACKET;

showdownAction = showdownAction.substring(0, showdownAction.indexOf(SHOWS_ACTION) + SHOWS_ACTION.length()) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private PokerstarsConstants() {

public static final String POKER_STARS_HAND = "PokerStars Hand #";

public static final String DEALT_TO_HERO = "Dealt to ";
public static final String FOLDS = " folds";
public static final String CHECKS = " checks";
public static final String CALLS = " calls ";
Expand Down

0 comments on commit de0521e

Please sign in to comment.