Start parsing results for #1. Include number parsing exceptions block. (#2)

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent e32d9564bb
commit 0e37e8e5ef
  1. 49
      readers/LoveLiveReader.java
  2. 36
      readers/Reader.java
  3. BIN
      result.png

@ -254,7 +254,11 @@ public class LoveLiveReader extends Reader{
String interpretOutput(String[] jp_data,String[] en_data) {
//[6, 0, 218, 0, 218, 48, 6, 48, 32 5 4 1 5, 0.9670235803680689]
//For each data point we want to first see if it's within the correct rectangular bounds and from there parse it as such.
double accuracy[] = new double[readRegions.size()];
double[] accuracy = new double[readRegions.size()];
String[] finalData = new String[readRegions.size()];
for (int i=0;i<finalData.length;i++) {
finalData[i]="";
}
for (int i=0;i<en_data.length;i+=10) {
int spacing=0;
for (int j=0;j<readRegions.size();j++) {
@ -270,6 +274,7 @@ public class LoveLiveReader extends Reader{
}
System.out.print("]");
System.out.println(" belongs to region "+j+".");
finalData[j]=finalData[j]+"\n"+en_data[i+8];
accuracy[j]=Double.parseDouble(en_data[i+9]);
break;
}
@ -277,8 +282,48 @@ public class LoveLiveReader extends Reader{
}
}
for (int i=0;i<jp_data.length;i+=10) {
int spacing=0;
for (int j=0;j<readRegions.size();j++) {
int midpoint=(Integer.parseInt(jp_data[i+1])+Integer.parseInt(jp_data[i+5]))/2;
if (midpoint>=spacing&&midpoint<=spacing+readRegions.get(j).h+REGION_PADDING
&&accuracy[j]<Double.parseDouble(jp_data[i+9])) {
System.out.print("JP[");
for (int k=0;k<10;k++) {
if (k!=0) {
System.out.print(",");
}
System.out.print(jp_data[i+k]);
}
System.out.print("]");
System.out.println(" belongs to region "+j+".");
if (accuracy[j]!=0) {
finalData[j]="";
}
finalData[j]=finalData[j]+"\n"+jp_data[i+8];
accuracy[j]=0;
break;
}
spacing+=readRegions.get(j).h+REGION_PADDING;
}
}
System.out.println(Arrays.toString(finalData));
interpretResults(finalData);
return null;
}
private void interpretResults(String[] finalData) {
for (int i=0;i<finalData.length;i++) {
String[] splitter = finalData[i].split(Pattern.quote("\n"));
switch (i) {
case 0:{
score=convertToInt(splitter);
}break;
case 1:{}break; //We will handle the grade with another system.
case 2:{
notes[0]=convertToInt("PERFECT",splitter);
}break;
}
}
System.out.println(this);
}
}

@ -3,6 +3,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.awt.Color;
@ -131,4 +132,39 @@ public abstract class Reader{
}
}
}
char[][] number_alternatives={
/*0*/{'0','o','O','e'},
/*1*/{'1','\\','/','I','i'},
/*2*/{'2'},
/*3*/{'3'},
/*4*/{'4'},
/*5*/{'5'},
/*6*/{'6','b'},
/*7*/{'7'},
/*8*/{'8','B'},
/*9*/{'9','g','y',},
};
int convertToInt(String[]data){return convertToInt("",data);}
int convertToInt(String prefix,String[] data) {
int numb=0;
for (int i=prefix.length();i<data.length;i++) {
String s = data[i];
for (int j=0;j<s.length();j++) {
if (s.charAt(j)>='0'&&s.charAt(j)<='9') {
numb*=10;
numb+=s.charAt(j)-'0';
}
}
}
return numb;
}
@Override
public String toString() {
return "Reader [difficulty=" + difficulty + ", maxcombo=" + maxcombo + ", notes=" + Arrays.toString(notes)
+ ", other=" + other + ", pct=" + pct + ", rank=" + rank + ", score=" + score + ", title=" + title
+ "]";
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Loading…
Cancel
Save