added validity checker for user submit

domainBranch
Emre Durak 2024-12-20 13:56:15 +01:00
parent 9e294e1c2d
commit c9be82826b
1 changed files with 23 additions and 0 deletions

View File

@ -72,4 +72,27 @@ public class HitoriMain extends JFrame implements AcrtionListener{
}
return buttons;
}
private static boolean abgabeMöglich(String path, String[][] data, String[][] colors) throws FileNotFoundException{
boolean abgabeMöglich = false;
String[][] result = getResult(data, colors);
ArrayList<String> filteredData = getSolution(path, result);
String[][] ergebnis1 = getErgebnisArray(result, filteredData);
int count = 0;
for(int i=0;i<result.length;i++){
for(int j=0;j<result.length;j++){
if(result[i][j].equals(ergebnis1[i][j])){
} else {
count--;
}
}
}
if(count <0){
abgabeMöglich = false;
} else {
abgabeMöglich = true;
}
return abgabeMöglich;
}
}