~eduardo_quiros/mainbrain

4cb6b646229356d7603737d19c6e6280dde8863d — Eduardo Quiros a month ago 40efc16 master
lib: arreglar procesamiento de pruebas
1 files changed, 7 insertions(+), 4 deletions(-)

M Lib/src/com/eduardoquiros/mainbrain/ui/Panel.java
M Lib/src/com/eduardoquiros/mainbrain/ui/Panel.java => Lib/src/com/eduardoquiros/mainbrain/ui/Panel.java +7 -4
@@ 174,11 174,14 @@ public class Panel extends javax.swing.JPanel {
    public int[] checkCode(String test) {
        int[] aciertos = new int[]{0, 0};
        int posicion = 0;
        for (var letter : test.toCharArray()) {
            if (letter == code.charAt(posicion)) {
        for (int i = 0; i < code.length(); i++) {
            if (test.charAt(i)==code.charAt(i))
                aciertos[0]++;
            } else if (code.contains(test.substring(posicion))) {
                aciertos[1]++;
        }
        if (aciertos[0] < 4){
            for (int i=0; i < test.length(); i++){
                if(code.contains(test.substring(i)))
                    aciertos[1]++;
            }
        }
        return aciertos;