From 37479e365e64d1c5d31dd7ec22e3fa8463dc9170 Mon Sep 17 00:00:00 2001 From: test Date: Fri, 28 Sep 2018 19:16:40 +0800 Subject: [PATCH 01/10] sometest --- src/main/java/featurecat/lizzie/Lizzie.java | 1 + src/main/java/featurecat/lizzie/Util.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/featurecat/lizzie/Lizzie.java b/src/main/java/featurecat/lizzie/Lizzie.java index f5c1b54cf..7df69f6dc 100644 --- a/src/main/java/featurecat/lizzie/Lizzie.java +++ b/src/main/java/featurecat/lizzie/Lizzie.java @@ -12,6 +12,7 @@ /** * Main class. */ + //test public class Lizzie { public static LizzieFrame frame; public static Leelaz leelaz; diff --git a/src/main/java/featurecat/lizzie/Util.java b/src/main/java/featurecat/lizzie/Util.java index 395dfd73a..7508a8b63 100644 --- a/src/main/java/featurecat/lizzie/Util.java +++ b/src/main/java/featurecat/lizzie/Util.java @@ -65,7 +65,7 @@ public static String downloadAsString(URL url) { e.printStackTrace(); } - return null; + return null; //test } /** From 67b4d7bacd6bc51c1d20efba1e5cab6ab94b3b63 Mon Sep 17 00:00:00 2001 From: test Date: Fri, 28 Sep 2018 19:26:33 +0800 Subject: [PATCH 02/10] test how it works test again --- src/main/java/featurecat/lizzie/Config.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/featurecat/lizzie/Config.java b/src/main/java/featurecat/lizzie/Config.java index 97d3e0789..f2d89315f 100644 --- a/src/main/java/featurecat/lizzie/Config.java +++ b/src/main/java/featurecat/lizzie/Config.java @@ -6,6 +6,8 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Iterator; +//撒旦发顺丰 + public class Config { From c3d67b1db3ff4c222ddffa4b172e252b114cdb0b Mon Sep 17 00:00:00 2001 From: test Date: Fri, 28 Sep 2018 20:57:07 +0800 Subject: [PATCH 03/10] Use mouse to navigate branchs of variation window Although we can navigate by keyboard, i have made it possible to use mouse --- src/main/java/featurecat/lizzie/Config.java | 2 - src/main/java/featurecat/lizzie/Lizzie.java | 1 - src/main/java/featurecat/lizzie/Util.java | 2 +- .../featurecat/lizzie/gui/LizzieFrame.java | 7 +- .../featurecat/lizzie/gui/VariationTree.java | 106 +++++++++++++++++- .../java/featurecat/lizzie/rules/Board.java | 52 +++++++++ 6 files changed, 163 insertions(+), 7 deletions(-) diff --git a/src/main/java/featurecat/lizzie/Config.java b/src/main/java/featurecat/lizzie/Config.java index f2d89315f..97d3e0789 100644 --- a/src/main/java/featurecat/lizzie/Config.java +++ b/src/main/java/featurecat/lizzie/Config.java @@ -6,8 +6,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Iterator; -//撒旦发顺丰 - public class Config { diff --git a/src/main/java/featurecat/lizzie/Lizzie.java b/src/main/java/featurecat/lizzie/Lizzie.java index 7df69f6dc..f5c1b54cf 100644 --- a/src/main/java/featurecat/lizzie/Lizzie.java +++ b/src/main/java/featurecat/lizzie/Lizzie.java @@ -12,7 +12,6 @@ /** * Main class. */ - //test public class Lizzie { public static LizzieFrame frame; public static Leelaz leelaz; diff --git a/src/main/java/featurecat/lizzie/Util.java b/src/main/java/featurecat/lizzie/Util.java index 7508a8b63..395dfd73a 100644 --- a/src/main/java/featurecat/lizzie/Util.java +++ b/src/main/java/featurecat/lizzie/Util.java @@ -65,7 +65,7 @@ public static String downloadAsString(URL url) { e.printStackTrace(); } - return null; //test + return null; } /** diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index fa45ff9de..b2f707931 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -772,7 +772,7 @@ public void onClicked(int x, int y) { // check for board click int[] boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y); int moveNumber = winrateGraph.moveNumber(x, y); - + if (boardCoordinates != null) { if (Lizzie.board.inAnalysisMode()) Lizzie.board.toggleAnalysis(); @@ -786,6 +786,11 @@ public void onClicked(int x, int y) { if (Lizzie.config.showSubBoard && subBoardRenderer.isInside(x, y)) { Lizzie.config.toggleLargeSubBoard(); } + + if (Lizzie.frame.variationTree.jumpVariationTree(x,y)!=0) { + //Lizzie.board.goToMoveNumber(moveNumber); + } + repaint(); } diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 6c873dc0e..76d30cf65 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -13,12 +13,15 @@ public class VariationTree { private int XSPACING; private int DOT_DIAM = 11; // Should be odd number - private ArrayList laneUsageList; - private BoardHistoryNode curMove; + private ArrayList laneUsageList, laneUsageList1; + private BoardHistoryNode curMove, curMove1; + + private int posx1, posy1, width1, height1; //Reserve a copy of varaition window axis public VariationTree() { laneUsageList = new ArrayList(); + laneUsageList1 = new ArrayList(); //for mouse click event } public void drawTree(Graphics2D g, int posx, int posy, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber, boolean isMain) @@ -114,6 +117,8 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); XSPACING = YSPACING; + posx1=posx;posy1=posy;width1=width;height1=height; //backup for mouse click event + // Draw background g.setColor(new Color(0, 0, 0, 60)); g.fillRect(posx, posy, width, height); @@ -142,4 +147,101 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { } drawTree(g, posx + xoffset, curposy, 0, posy + height, node, 0,true); } + + + //clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode + public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) + { + // Finds depth on leftmost variation of this tree + int depth = BoardHistoryList.getDepth(startNode) + 1; + int lane = startLane; + // Figures out how far out too the right (which lane) we have to go not to collide with other variations + while (lane < laneUsageList1.size() && laneUsageList1.get(lane) <= startNode.getData().moveNumber + depth) { + // laneUsageList keeps a list of how far down it is to a variation in the different "lanes" + laneUsageList1.set(lane, startNode.getData().moveNumber - 1); + lane++; + } + if (lane >= laneUsageList1.size()) + { + laneUsageList1.add(0); + } + if (variationNumber > 1) + laneUsageList1.set(lane - 1, startNode.getData().moveNumber - 1); + laneUsageList1.set(lane, startNode.getData().moveNumber); + + // At this point, lane contains the lane we should use (the main branch is in lane 0) + + BoardHistoryNode cur = startNode; + int curposx = posx + lane*XSPACING; + int dotoffset = DOT_DIAM/2; + + + // Check first node + if ((mouseX-curposx)*(mouseX-curposx)+(mouseY-posy)*(mouseY-posy) < (DOT_DIAM)*(DOT_DIAM)) + return startNode; + + + // Draw main line + while (cur.next() != null && posy + YSPACING < maxposy) { + posy += YSPACING; + cur = cur.next(); + if ((mouseX-curposx)*(mouseX-curposx)+(mouseY-posy)*(mouseY-posy) < (DOT_DIAM)*(DOT_DIAM)) + return cur; + + } + // Now we have drawn all the nodes in this variation, and has reached the bottom of this variation + // Move back up, and for each, draw any variations we find + while (cur.previous() != null && cur != startNode) { + cur = cur.previous(); + int curwidth = lane; + BoardHistoryNode ret; + // Draw each variation, uses recursion + for (int i = 1; i < cur.numberOfChildren(); i++) { + curwidth++; + // Recursion, depth of recursion will normally not be very deep (one recursion level for every variation that has a variation (sort of)) + if((ret=inSubtree(posx, posy, mouseX, mouseY, curwidth, maxposy, cur.getVariation(i), i)) !=null) + return ret; + } + posy -= YSPACING; + } + return null; + } + + public BoardHistoryNode inVariationTree(int mouseX, int mouseY) { + + //check if (x,y) is in the variation window + if (mouseX < posx1 || mouseX > posx1+width1 || mouseY < posy1 || mouseY > posy1+height1) + return null; + + // Use dense tree for saving space if large-subboard + YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); + XSPACING = YSPACING; + + + int middleY = posy1 + height1/2; + int xoffset = 30; + laneUsageList1.clear(); + + curMove1 = Lizzie.board.getHistory().getCurrentHistoryNode(); + + // Is current move a variation? If so, find top of variation + BoardHistoryNode top = BoardHistoryList.findTop(curMove1); + int curposy = middleY - YSPACING*(curMove1.getData().moveNumber - top.getData().moveNumber); + // Go to very top of tree (visible in assigned area) + BoardHistoryNode node = top; + while (curposy > posy1 + YSPACING && node.previous() != null) { + node = node.previous(); + curposy -= YSPACING; + } + return inSubtree(posx1 + xoffset, curposy, mouseX, mouseY,0, posy1 + height1, node, 0); + + } + + public int jumpVariationTree(int mouseX, int mouseY){ + BoardHistoryNode node; + node = inVariationTree(mouseX, mouseY); //check if (x,y) hit proper branch node + if (node!=null) + Lizzie.board.jumpToAnyPosition(node); + return 0; + } } diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index fcac07cc7..5d9a72244 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -483,6 +483,58 @@ public boolean nextVariation(int idx) { } } + + // jump anywhere in the board history tree. Written for mouse click navigation + public void jumpToAnyPosition(BoardHistoryNode targetNode) { + BoardHistoryNode srcNode, tarNode=targetNode, prevNode; + + int[] tar = new int[512], src = new int[512]; int i=0 ,j=0, k=0; + + prevNode=tarNode.previous(); + while(prevNode != null){ + for(k=0;k0;m--) + nextVariation(tar[m-1]); + } + + else { + // in the different branchs, must move back first, then move forword + for (int m=0; m0;m--){ + nextVariation(tar[m-1]); + } + } + } + + /* * Moves to next variation (variation to the right) if possible * To move to another variation, the variation must have a move with the same move number as the current move in it. From abb3a4feb6ba3fc989de23e946824f9ae7e8467d Mon Sep 17 00:00:00 2001 From: tt Date: Sat, 29 Sep 2018 10:08:04 +0800 Subject: [PATCH 04/10] increase mouse sensetivity --- src/main/java/featurecat/lizzie/gui/VariationTree.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 76d30cf65..1e44560e0 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -177,7 +177,7 @@ public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, in // Check first node - if ((mouseX-curposx)*(mouseX-curposx)+(mouseY-posy)*(mouseY-posy) < (DOT_DIAM)*(DOT_DIAM)) + if ( Math.abs(mouseX-curposx) < XSPACING/2 && Math.abs(mouseY-posy) < YSPACING/2) return startNode; @@ -185,7 +185,7 @@ public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, in while (cur.next() != null && posy + YSPACING < maxposy) { posy += YSPACING; cur = cur.next(); - if ((mouseX-curposx)*(mouseX-curposx)+(mouseY-posy)*(mouseY-posy) < (DOT_DIAM)*(DOT_DIAM)) + if (Math.abs(mouseX-curposx) < XSPACING/2 && Math.abs(mouseY-posy) < YSPACING/2) return cur; } From 9b88e4dac44a2147769ebb871c4cbbd00fd87997 Mon Sep 17 00:00:00 2001 From: tt Date: Sat, 29 Sep 2018 21:04:54 +0800 Subject: [PATCH 05/10] Do nothing if showVariation is disabled --- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index b2f707931..5e6657924 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -787,9 +787,9 @@ public void onClicked(int x, int y) { Lizzie.config.toggleLargeSubBoard(); } - if (Lizzie.frame.variationTree.jumpVariationTree(x,y)!=0) { - //Lizzie.board.goToMoveNumber(moveNumber); - } + if (Lizzie.config.showVariationGraph) { + Lizzie.frame.variationTree.jumpVariationTree(x,y); + } repaint(); } From c31e5b1dada7966bff5be1d987b36b6c775e9415 Mon Sep 17 00:00:00 2001 From: tt Date: Mon, 1 Oct 2018 11:13:16 +0800 Subject: [PATCH 06/10] BUGFIX. Add offset to make (x,y) more precise --- src/main/java/featurecat/lizzie/gui/VariationTree.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 1e44560e0..0b039eab7 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -177,7 +177,7 @@ public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, in // Check first node - if ( Math.abs(mouseX-curposx) < XSPACING/2 && Math.abs(mouseY-posy) < YSPACING/2) + if ( Math.abs(mouseX-curposx-dotoffset) < XSPACING/2 && Math.abs(mouseY-posy-dotoffset) < YSPACING/2) return startNode; @@ -185,7 +185,7 @@ public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, in while (cur.next() != null && posy + YSPACING < maxposy) { posy += YSPACING; cur = cur.next(); - if (Math.abs(mouseX-curposx) < XSPACING/2 && Math.abs(mouseY-posy) < YSPACING/2) + if (Math.abs(mouseX-curposx-dotoffset) < XSPACING/2 && Math.abs(mouseY-posy-dotoffset) < YSPACING/2) return cur; } From 25f74cfa91328c0a25033ea3c0c98295b8a57866 Mon Sep 17 00:00:00 2001 From: tt Date: Tue, 2 Oct 2018 14:42:57 +0800 Subject: [PATCH 07/10] Add more comments, clean code, due to PR --- .../featurecat/lizzie/gui/VariationTree.java | 23 ++++---- .../java/featurecat/lizzie/rules/Board.java | 58 ++++++++++--------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 0b039eab7..14d72f658 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -117,7 +117,7 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); XSPACING = YSPACING; - posx1=posx;posy1=posy;width1=width;height1=height; //backup for mouse click event + posx1=posx;posy1=posy;width1=width;height1=height; //backup for mouse click event // Draw background g.setColor(new Color(0, 0, 0, 60)); @@ -149,7 +149,7 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { } - //clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode + //Clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) { // Finds depth on leftmost variation of this tree @@ -205,13 +205,14 @@ public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, in posy -= YSPACING; } return null; - } - + } + + //Clone from draw() method but draw nothing, just caculate (x,y)->BoardNode public BoardHistoryNode inVariationTree(int mouseX, int mouseY) { - //check if (x,y) is in the variation window - if (mouseX < posx1 || mouseX > posx1+width1 || mouseY < posy1 || mouseY > posy1+height1) - return null; + //check if (x,y) is in the variation window + if (mouseX < posx1 || mouseX > posx1+width1 || mouseY < posy1 || mouseY > posy1+height1) + return null; // Use dense tree for saving space if large-subboard YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); @@ -235,13 +236,13 @@ public BoardHistoryNode inVariationTree(int mouseX, int mouseY) { } return inSubtree(posx1 + xoffset, curposy, mouseX, mouseY,0, posy1 + height1, node, 0); - } + } public int jumpVariationTree(int mouseX, int mouseY){ BoardHistoryNode node; node = inVariationTree(mouseX, mouseY); //check if (x,y) hit proper branch node - if (node!=null) - Lizzie.board.jumpToAnyPosition(node); - return 0; + if (node==null) return -1; //check if any error occur + Lizzie.board.jumpToAnyPosition(node); + return 0; } } diff --git a/src/main/java/featurecat/lizzie/rules/Board.java b/src/main/java/featurecat/lizzie/rules/Board.java index 2c3853283..bd0462288 100644 --- a/src/main/java/featurecat/lizzie/rules/Board.java +++ b/src/main/java/featurecat/lizzie/rules/Board.java @@ -489,12 +489,18 @@ public boolean nextVariation(int idx) { } - // jump anywhere in the board history tree. Written for mouse click navigation + // Jump anywhere in the board history tree. Written for mouse click navigation public void jumpToAnyPosition(BoardHistoryNode targetNode) { - BoardHistoryNode srcNode, tarNode=targetNode, prevNode; - - int[] tar = new int[512], src = new int[512]; int i=0 ,j=0, k=0; - + BoardHistoryNode srcNode, tarNode, prevNode; + + //tar[] to track path from target node to root node + //src[] to track path from source node to root node + int[] tar = new int[512], src = new int[512]; + + int i=0 ,j=0, k=0; //i is index for target node, j for source node, k is working variable + + //find path from target node to root node + tarNode=targetNode; prevNode=tarNode.previous(); while(prevNode != null){ for(k=0;k0;m--) - nextVariation(tar[m-1]); - } - - else { - // in the different branchs, must move back first, then move forword - for (int m=0; m0;m--){ - nextVariation(tar[m-1]); - } - } - } + nextVariation(tar[m-1]); + + } else { + // in the different branchs, must move back first, then move forword + for (int m=0; m0;m--) + nextVariation(tar[m-1]); + } + } /* From b5c8740d0b65ae5c8ecb528dcdb8773d9f05117f Mon Sep 17 00:00:00 2001 From: phiming Date: Fri, 5 Oct 2018 11:56:27 +0800 Subject: [PATCH 08/10] Delete blanks, spaces, divide some lines due to PR --- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 5 ++--- .../java/featurecat/lizzie/gui/VariationTree.java | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index f02f4e091..71d4289a1 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -807,8 +807,7 @@ private void setPanelFont(Graphics2D g, float size) { public void onClicked(int x, int y) { // check for board click int[] boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y); - int moveNumber = winrateGraph.moveNumber(x, y); - + int moveNumber = winrateGraph.moveNumber(x, y); if (boardCoordinates != null) { if (Lizzie.board.inAnalysisMode()) Lizzie.board.toggleAnalysis(); @@ -824,7 +823,7 @@ public void onClicked(int x, int y) { } if (Lizzie.config.showVariationGraph) { - Lizzie.frame.variationTree.jumpVariationTree(x,y); + Lizzie.frame.variationTree.jumpVariationTree(x, y); } repaint(); diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 14d72f658..3a1bcbbc5 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -13,7 +13,7 @@ public class VariationTree { private int XSPACING; private int DOT_DIAM = 11; // Should be odd number - private ArrayList laneUsageList, laneUsageList1; + private ArrayList laneUsageList, laneUsageList1; //laneUsageList1 is lane used to cacalate (x,y) private BoardHistoryNode curMove, curMove1; private int posx1, posy1, width1, height1; //Reserve a copy of varaition window axis @@ -21,7 +21,7 @@ public class VariationTree { public VariationTree() { laneUsageList = new ArrayList(); - laneUsageList1 = new ArrayList(); //for mouse click event + laneUsageList1 = new ArrayList(); //for mouse click event } public void drawTree(Graphics2D g, int posx, int posy, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber, boolean isMain) @@ -117,7 +117,10 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); XSPACING = YSPACING; - posx1=posx;posy1=posy;width1=width;height1=height; //backup for mouse click event + posx1 = posx; + posy1 = posy; + width1 = width; + height1 = height; //backup for mouse click event // Draw background g.setColor(new Color(0, 0, 0, 60)); @@ -147,8 +150,6 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { } drawTree(g, posx + xoffset, curposy, 0, posy + height, node, 0,true); } - - //Clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) { From 2a22123d1e4a8f67fcc8593fe3e8ec42979517e9 Mon Sep 17 00:00:00 2001 From: phiming Date: Fri, 5 Oct 2018 11:56:27 +0800 Subject: [PATCH 09/10] Delete blanks, spaces, divide some lines due to PR --- src/main/java/featurecat/lizzie/gui/LizzieFrame.java | 5 ++--- .../java/featurecat/lizzie/gui/VariationTree.java | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java index f02f4e091..71d4289a1 100644 --- a/src/main/java/featurecat/lizzie/gui/LizzieFrame.java +++ b/src/main/java/featurecat/lizzie/gui/LizzieFrame.java @@ -807,8 +807,7 @@ private void setPanelFont(Graphics2D g, float size) { public void onClicked(int x, int y) { // check for board click int[] boardCoordinates = boardRenderer.convertScreenToCoordinates(x, y); - int moveNumber = winrateGraph.moveNumber(x, y); - + int moveNumber = winrateGraph.moveNumber(x, y); if (boardCoordinates != null) { if (Lizzie.board.inAnalysisMode()) Lizzie.board.toggleAnalysis(); @@ -824,7 +823,7 @@ public void onClicked(int x, int y) { } if (Lizzie.config.showVariationGraph) { - Lizzie.frame.variationTree.jumpVariationTree(x,y); + Lizzie.frame.variationTree.jumpVariationTree(x, y); } repaint(); diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 14d72f658..3a1bcbbc5 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -13,7 +13,7 @@ public class VariationTree { private int XSPACING; private int DOT_DIAM = 11; // Should be odd number - private ArrayList laneUsageList, laneUsageList1; + private ArrayList laneUsageList, laneUsageList1; //laneUsageList1 is lane used to cacalate (x,y) private BoardHistoryNode curMove, curMove1; private int posx1, posy1, width1, height1; //Reserve a copy of varaition window axis @@ -21,7 +21,7 @@ public class VariationTree { public VariationTree() { laneUsageList = new ArrayList(); - laneUsageList1 = new ArrayList(); //for mouse click event + laneUsageList1 = new ArrayList(); //for mouse click event } public void drawTree(Graphics2D g, int posx, int posy, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber, boolean isMain) @@ -117,7 +117,10 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { YSPACING = (Lizzie.config.showLargeSubBoard() ? 20 : 30); XSPACING = YSPACING; - posx1=posx;posy1=posy;width1=width;height1=height; //backup for mouse click event + posx1 = posx; + posy1 = posy; + width1 = width; + height1 = height; //backup for mouse click event // Draw background g.setColor(new Color(0, 0, 0, 60)); @@ -147,8 +150,6 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { } drawTree(g, posx + xoffset, curposy, 0, posy + height, node, 0,true); } - - //Clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) { From e97db1afe0e642d30a9ec6165f974fbdd3432814 Mon Sep 17 00:00:00 2001 From: phiming Date: Fri, 5 Oct 2018 12:18:30 +0800 Subject: [PATCH 10/10] Delete space --- src/main/java/featurecat/lizzie/gui/VariationTree.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/featurecat/lizzie/gui/VariationTree.java b/src/main/java/featurecat/lizzie/gui/VariationTree.java index 3a1bcbbc5..cb659ffee 100644 --- a/src/main/java/featurecat/lizzie/gui/VariationTree.java +++ b/src/main/java/featurecat/lizzie/gui/VariationTree.java @@ -15,8 +15,7 @@ public class VariationTree { private ArrayList laneUsageList, laneUsageList1; //laneUsageList1 is lane used to cacalate (x,y) private BoardHistoryNode curMove, curMove1; - - private int posx1, posy1, width1, height1; //Reserve a copy of varaition window axis + private int posx1, posy1, width1, height1; //Reserve a copy of varaition window axis public VariationTree() { @@ -151,8 +150,7 @@ public void draw(Graphics2D g, int posx, int posy, int width, int height) { drawTree(g, posx + xoffset, curposy, 0, posy + height, node, 0,true); } //Clone from drawTree() method but draw nothing, just caculate (x,y)->BoardNode - public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) - { + public BoardHistoryNode inSubtree(int posx, int posy, int mouseX, int mouseY, int startLane, int maxposy, BoardHistoryNode startNode, int variationNumber) { // Finds depth on leftmost variation of this tree int depth = BoardHistoryList.getDepth(startNode) + 1; int lane = startLane;