Search:

Type: Posts; User: Warow

Search: Search took 0.07 seconds.

  1. Replies
    7
    Views
    1,517

    Re: Code guessing game, need help with arrays

    Finally works. Added:


    int count = 0;
    for (int i=0; i<5; i++) {
    if (secretNumber[i] == guess[i])
    count++;
    }

    if (count >= 3)
  2. Replies
    7
    Views
    1,517

    Re: Code guessing game, need help with arrays

    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);
    }
    ...
  3. Replies
    7
    Views
    1,517

    Re: Code guessing game, need help with arrays

    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?
  4. Replies
    7
    Views
    1,517

    Code guessing game, need help with arrays

    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...
Results 1 to 4 of 4