samedi 30 mai 2015

Mastermind game if statement problems

I am trying to make it so when two or more of my if statements work they dont both print instead they just say two are in the correct spot or more it more works. Im not sure if im suppose to make more if statements of if i am suppose to use another statement or a forloop.

               //If Statements
                if (Gameboard[0] == Secret_code[0]) {
                    System.out.println ("You have one in the correct spot");
    } 
                if (Gameboard[1] == Secret_code[1]) {
                    System.out.println ("You have one in the correct spot");
    }
                if (Gameboard[2] == Secret_code[2]) {
                    System.out.println ("You have one in the correct spot");
    }
                if (Gameboard[3] == Secret_code[3]) {
                    System.out.println ("You have one in the correct spot");
    }

}
}

Aucun commentaire:

Enregistrer un commentaire