Finally works. Added:
int count = 0;
for (int i=0; i<5; i++) {
if (secretNumber[i] == guess[i])
count++;
}
if (count >= 3)
Type: Posts; User: Warow
Finally works. Added:
int count = 0;
for (int i=0; i<5; i++) {
if (secretNumber[i] == guess[i])
count++;
}
if (count >= 3)
Thanks once more for your reaction. I've changed the first bit to:
for (int i=0; i<5; i++) {
secretNumber[i] = (int) (Math.random() * 2 + 1);
}
...
Thanks for the quick reply. Although it sounds pretty logical, I can't quite imagine how I'd do this. Might you have an example I can see?
Hey everyone,
So I made the following code... It does what it's expected to do, however it's not efficiënt at all.
It's a game where you have to guess at least 3 'secret numbers' to win. The...