diff --git a/d4dj_rankTracker.jar b/d4dj_rankTracker.jar index 9eacd2a..2cbf744 100644 Binary files a/d4dj_rankTracker.jar and b/d4dj_rankTracker.jar differ diff --git a/paragraph2.png b/paragraph2.png new file mode 100644 index 0000000..e47b9b5 Binary files /dev/null and b/paragraph2.png differ diff --git a/paragraph3.png b/paragraph3.png new file mode 100644 index 0000000..f796c7b Binary files /dev/null and b/paragraph3.png differ diff --git a/src/main/java/d4dj/d4dj/Annotation.java b/src/main/java/d4dj/d4dj/Annotation.java new file mode 100644 index 0000000..eef42cf --- /dev/null +++ b/src/main/java/d4dj/d4dj/Annotation.java @@ -0,0 +1,6 @@ +package d4dj.d4dj; + +public class Annotation { + String text; + String vertices; +} diff --git a/src/main/java/d4dj/d4dj/App.java b/src/main/java/d4dj/d4dj/App.java index e68b4f0..7a6bdc0 100644 --- a/src/main/java/d4dj/d4dj/App.java +++ b/src/main/java/d4dj/d4dj/App.java @@ -51,10 +51,10 @@ import net.sourceforge.tess4j.Tesseract; import net.sourceforge.tess4j.TesseractException; import sig.utils.ImageUtils; class SubmitThread implements Runnable{ - String name,description,points; - int event,rank; + String name,description; + int event,rank,points; - SubmitThread(String name,String description,String points,int event,int rank) { + SubmitThread(String name,String description,int points,int event,int rank) { this.name=name; this.description=description; this.points=points; @@ -71,7 +71,7 @@ class SubmitThread implements Runnable{ params.add(new BasicNameValuePair("rank", Integer.toString(rank))); params.add(new BasicNameValuePair("name", name)); params.add(new BasicNameValuePair("description", description)); - params.add(new BasicNameValuePair("points", points)); + params.add(new BasicNameValuePair("points", Integer.toString(points))); try { httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); } catch (UnsupportedEncodingException e) { @@ -101,8 +101,8 @@ class SubmitThread implements Runnable{ } public class App { - public static Image paragraph; - final static int EVENT = 11; + public static Image paragraph,paragraph2,paragraph3; + final static int EVENT = 12; public static int[] lastScores = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; public static int[] lastLowerTierScores = new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; @@ -163,13 +163,15 @@ public class App Image leaderboard4 = ImageIO.read(list[3]); Image leaderboard5 = ImageIO.read(list[4]); paragraph = ImageIO.read(new File("paragraph.png")); + paragraph2 = ImageIO.read(new File("paragraph2.png")); + paragraph3 = ImageIO.read(new File("paragraph3.png")); BufferedImage cropped1 = new BufferedImage(360,26*114,BufferedImage.TYPE_INT_ARGB); Graphics2D g = cropped1.createGraphics(); //For comments: down by 40, width is 340. for (int i=0;i responses = response.getResponsesList(); @@ -293,105 +306,95 @@ public class App // For full list of available annotations, see http://g.co/cloud/vision/docs for (EntityAnnotation annotation : res.getTextAnnotationsList()) { reader.append(annotation.getDescription()); + //System.out.format("Position : %s%n", annotation.getBoundingPoly()); break; //System.out.println(annotation.getDescription()); //System.out.format("Text: %s%n", annotation.getDescription()); - //System.out.format("Position : %s%n", annotation.getBoundingPoly()); } } client.close(); } //System.out.println(reader); + + + List descriptions = new ArrayList(); + List names = new ArrayList(); + List scores = new ArrayList(); + int[] ranks = new int[] {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + 50,100,500,1000,2000,5000,10000,20000,30000,50000}; + String[] s = reader.toString().split("\n"); String[] data = new String[s.length]; int count=0; + boolean scoreNext=false; for (String ss : s) { //System.out.println(ss.replaceFirst("A","").trim()); - String newString = ss.replaceFirst("A","").trim(); - data[count++]=newString; - } - System.out.println(Arrays.toString(data)); - String[] t20names = new String[20]; - int arrayOffset = 0; - for (int i=0;i<20;i++) { - t20names[i]=data[arrayOffset++]; - } - String[] t20desc = new String[20]; - for (int i=0;i<20;i++) { - t20desc[i]=data[arrayOffset++]; - } - String[] t20scores = new String[20]; - for (int i=0;i<20;i++) { - if (data[arrayOffset+1].length()>0) { - arrayOffset++; + //String newString = ss;//.replaceFirst("A","").trim(); + if (StringUtils.isNumeric(ss)) { + if (scores.size()>20) { + //See if this score is already in list. + int thisScore = Integer.parseInt(ss); + boolean found=false; + for (int i=0;ii)?descriptions.get(i):""; + String name = (names.size()>i)?names.get(i):""; + System.out.println(ranks[i]+"-"+name+": "+scores.get(i)); + + new Thread( + new SubmitThread(name,desc,scores.get(i),EVENT,ranks[i])) + .start(); } - String[] tempLowerTierDesc = new String[18]; - for (int i=0;i<18;i++) { - tempLowerTierDesc[i]=data[arrayOffset++]; - } - String[] tempLowerTierScores = new String[18]; - for (int i=0;i<18;i++) { - if (data[arrayOffset+1].length()>0) { - arrayOffset++; - } - tempLowerTierScores[i]=data[arrayOffset++]; - } - //System.out.println(Arrays.toString(t20scores)); - //System.out.println(Arrays.toString(tempLowerTierScores)); - //Lower tier order is: 50,100,500,1000,2000,5000,10000,20000,30000,50000 - - String[] lowerTierNames = new String[]{"","","","","","","","","",""}; - String[] lowerTierDesc = new String[]{"","","","","","","","","",""}; - String[] lowerTierScores = new String[]{"0","0","0","0","0","0","0","0","0","0"}; + /*System.out.println(scores); + System.out.println(names); + System.out.println(descriptions);*/ - for (int i=0;i<9;i++) { - lowerTierNames[i]=tempLowerTierNames[i]; - lowerTierDesc[i]=tempLowerTierDesc[i]; - lowerTierScores[i]=tempLowerTierScores[i]; - } - - - for (int i=9;i<18;i++) { - //Look at the upper tier scores, if it exists we skip it. - boolean exists=false; - for (int j=0;j<9;j++) { - if (tempLowerTierScores[i].equalsIgnoreCase(tempLowerTierScores[j])) { - exists=true; - break; - } - } - if (!exists) { - lowerTierNames[9]=tempLowerTierNames[i]; - lowerTierDesc[9]=tempLowerTierDesc[i]; - lowerTierScores[9]=tempLowerTierScores[i]; - break; - } - } - System.out.println(Arrays.toString(t20scores)); - System.out.println(Arrays.toString(lowerTierScores)); - boolean error1=false; - for (int i=0;i<20;i++) { - if (!StringUtils.isNumeric(t20scores[i])) { - error1=true; - break; - } - }//227 - boolean error2=false; - for (int i=0;i<10;i++) { - if (!StringUtils.isNumeric(lowerTierScores[i])) { - error2=true; - break; + + /* + for (int i=0;i0) { + if (scores.size()<) } - } + }*/ + //System.out.println(Arrays.toString(t20scores)); + //System.out.println(Arrays.toString(tempLowerTierScores)); + //Lower tier order is: 50,100,500,1000,2000,5000,10000,20000,30000,50000 + /* if (!error1) { for (int i=0;i<20;i++) { new Thread( @@ -417,7 +420,7 @@ public class App } else { System.out.println("Cannot submit lower tier scores. Invalid array params."); } - + */ } } diff --git a/target/classes/d4dj/d4dj/Annotation.class b/target/classes/d4dj/d4dj/Annotation.class new file mode 100644 index 0000000..831248a Binary files /dev/null and b/target/classes/d4dj/d4dj/Annotation.class differ diff --git a/target/classes/d4dj/d4dj/App.class b/target/classes/d4dj/d4dj/App.class index 792587f..a8a3f4b 100644 Binary files a/target/classes/d4dj/d4dj/App.class and b/target/classes/d4dj/d4dj/App.class differ diff --git a/target/classes/d4dj/d4dj/SubmitThread.class b/target/classes/d4dj/d4dj/SubmitThread.class index 3f3de61..42ae396 100644 Binary files a/target/classes/d4dj/d4dj/SubmitThread.class and b/target/classes/d4dj/d4dj/SubmitThread.class differ diff --git a/testing_leaderboardnames.png b/testing_leaderboardnames.png index ded8075..565e80e 100644 Binary files a/testing_leaderboardnames.png and b/testing_leaderboardnames.png differ