Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable threshold for displaying move statistics. #333

Merged
merged 1 commit into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/featurecat/lizzie/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ private JSONObject createDefaultConfig() {
ui.put("window-size", new JSONArray("[1024, 768]"));
ui.put("window-maximized", false);
ui.put("show-dynamic-komi", true);
ui.put("min-playout-ratio-for-stats", 0.0);

config.put("ui", ui);
return config;
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/featurecat/lizzie/gui/BoardRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,10 @@ private void drawLeelazSuggestions(Graphics2D g) {
return;

final int MIN_ALPHA = 32;
final int MIN_ALPHA_TO_DISPLAY_TEXT = 64;
final int MAX_ALPHA = maxAlpha = Math.max(maxAlpha, MIN_ALPHA_TO_DISPLAY_TEXT);
final double HUE_SCALING_FACTOR = 3.0;
final double ALPHA_SCALING_FACTOR = 5.0;
final float GREEN_HUE = Color.RGBtoHSB(0,1,0,null)[0];
final float CYAN_HUE = Color.RGBtoHSB(0,1,1,null)[0];
final float GREEN_HUE = Color.RGBtoHSB(0, 1, 0, null)[0];
final float CYAN_HUE = Color.RGBtoHSB(0, 1, 1, null)[0];

if (!bestMoves.isEmpty()) {

Expand Down Expand Up @@ -558,7 +556,7 @@ private void drawLeelazSuggestions(Graphics2D g) {
float hue = isBestMove ? CYAN_HUE : (float) (-GREEN_HUE * Math.max(0, Math.log(percentPlayouts) / HUE_SCALING_FACTOR + 1));
float saturation = 0.75f; //saturation
float brightness = 0.85f; //brightness
int alpha = (int) (MIN_ALPHA + (MAX_ALPHA - MIN_ALPHA) * Math.max(0, Math.log(percentPlayouts) /
int alpha = (int) (MIN_ALPHA + (maxAlpha - MIN_ALPHA) * Math.max(0, Math.log(percentPlayouts) /
ALPHA_SCALING_FACTOR + 1));
// if (uiConfig.getBoolean("shadows-enabled"))
// alpha = 255;
Expand Down Expand Up @@ -586,7 +584,8 @@ private void drawLeelazSuggestions(Graphics2D g) {
}


if (branch == null && (alpha >= MIN_ALPHA_TO_DISPLAY_TEXT || hasMaxWinrate) || (Lizzie.frame.mouseHoverCoordinate != null && coordinates[0] == Lizzie.frame.mouseHoverCoordinate[0] && coordinates[1] == Lizzie.frame.mouseHoverCoordinate[1])) {
if ((branch == null && (hasMaxWinrate || percentPlayouts >= uiConfig.getDouble("min-playout-ratio-for-stats"))) ||
(Lizzie.frame.mouseHoverCoordinate != null && coordinates[0] == Lizzie.frame.mouseHoverCoordinate[0] && coordinates[1] == Lizzie.frame.mouseHoverCoordinate[1])) {
double roundedWinrate = Math.round(move.winrate * 10) / 10.0;
if (uiConfig.getBoolean("win-rate-always-black") && !Lizzie.board.getData().blackToPlay) {
roundedWinrate = 100.0 - roundedWinrate;
Expand Down