added validity checker for user submit
parent
9e294e1c2d
commit
c9be82826b
|
|
@ -72,4 +72,27 @@ public class HitoriMain extends JFrame implements AcrtionListener{
|
||||||
}
|
}
|
||||||
return buttons;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue