Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
evolutionsoft authored and evolutionsoft committed Dec 4, 2022
2 parents 04bb1b0 + b385717 commit 37d1d3b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,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.3-jar-with-dependencies.jar' and the two properties files:
Execute from the directory with containing 'handhistory-converter-0.2.4-jar-with-dependencies.jar' and the two properties files:

```
java -jar handhistory-converter-0.2.3-jar-with-dependencies.jar
java -jar handhistory-converter-0.2.4-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 pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.evolutionsoft.poker.pokernow</groupId>
<artifactId>handhistory-converter</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ private PokernowConstants() {
public static final String OMAHA_GAME_TYPE = "Pot Limit Omaha Hi";
public static final String OMAHA_HI_LO_GAME_TYPE = "Pot Limit Omaha Hi/Lo";
public static final String TEXAS_GAME_TYPE = "No Limit Texas Hold'em";
public static final int GAME_TYPE_GROUP = 1;

public static final String STARTING_HAND = "-- starting hand #";
public static final String ENDING_HAND = "-- ending hand #";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -65,9 +67,20 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
String singleHandHistoryLine = bufferedReader.readLine();

String handNumber = readHandNumber(singleHandHistoryLine);

String gameType = singleHandHistoryLine.substring(
singleHandHistoryLine.indexOf('(') + 1, singleHandHistoryLine.indexOf(')'));

Pattern gameTypeGameIdPattern = Pattern.compile(
"hand " + HAND_NUMBER_PREFIX_CHAR + "\\d+ \\(id: \\w+\\)\\s+\\(([^\\)]+)\\)"
);

Matcher m = gameTypeGameIdPattern.matcher(singleHandHistoryLine);
String gameType = "UndefinedGameType";

if (m.find()) {
gameType = m.group(GAME_TYPE_GROUP) + " ";
} else {
handConversionLog.warn("Gametype could not be parsed from history line: \"{}\"", singleHandHistoryLine);
}

String timeString = singleHandHistoryLine.substring(
singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.lastIndexOf('.'));
timeString = timeString.replace("-", FORWARD_SLASH);
Expand Down Expand Up @@ -367,7 +380,7 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
String readHandNumber(String singleHandHistoryLine) {

return singleHandHistoryLine.substring(singleHandHistoryLine.indexOf(HAND_NUMBER_PREFIX_CHAR) + 1,
singleHandHistoryLine.indexOf(" ", singleHandHistoryLine.indexOf(HAND_NUMBER_PREFIX_CHAR)));
singleHandHistoryLine.indexOf(" (id"));
}

String createConvertedHandSummary(String buttonPlayerName, String playerSummary, String smallBlindPlayerName,
Expand Down

0 comments on commit 37d1d3b

Please sign in to comment.