From 9c918c7bbb3cd4c08d1f2b370fded20627a03f9d Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 21 Nov 2023 07:43:46 -0600 Subject: [PATCH] Improve multiverse similarity logic and fix incorrect log --- .../core/file/subDimMatching/SubDimCompare.java | 7 +++++-- .../core/file/subDimMatching/SubDimensionLevelMatcher.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimCompare.java b/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimCompare.java index 1688efd20..7cb01b7ae 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimCompare.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimCompare.java @@ -57,7 +57,7 @@ public class SubDimCompare implements Comparable } /** returns a number between 0 (no equal datapoint) and 1 (totally equal) */ - public double getPercentEqual() { return (double) equalDataPoints / (double) totalDataPoints; } + public double getPercentEqual() { return (double) this.equalDataPoints / (double) this.totalDataPoints; } @Override @@ -66,7 +66,7 @@ public class SubDimCompare implements Comparable if (this.equalDataPoints != other.equalDataPoints) { // compare based on data points - return Integer.compare(this.equalDataPoints, other.equalDataPoints); + return Double.compare(this.getPercentEqual(), other.getPercentEqual()); } else { @@ -83,4 +83,7 @@ public class SubDimCompare implements Comparable || this.playerPosDist <= MAX_SIMILAR_PLAYER_POS_DISTANCE_IN_BLOCKS; } + @Override + public String toString() { return this.equalDataPoints + "/" + this.totalDataPoints + ": " + this.getPercentEqual() + " playerPos: " + this.playerPosDist; } + } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimensionLevelMatcher.java b/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimensionLevelMatcher.java index 276c48dd4..2b087059a 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimensionLevelMatcher.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/subDimMatching/SubDimensionLevelMatcher.java @@ -332,7 +332,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable String subDimShortName = LodUtil.shortenString(testLevelFolder.getName(), 8); // variables are separated out for easier debugging - String equalPercent = LodUtil.shortenString(subDimCompare.getPercentEqual()+"", 5); + String equalPercent = LodUtil.shortenString(mostSimilarSubDim.getPercentEqual()+"", 5); LOGGER.info("Sub dimension ["+subDimShortName+"...] is current dimension probability: "+equalPercent+" ("+equalDataPoints+"/"+totalDataPointCount+")"); } catch (Exception e)