Thread: need some help to upgrade a mini game in C

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    15

    need some help to upgrade a mini game in C

    HI!

    Well, since I started learning C the other day, I thought it was pretty cool... I went through a few things, and just learned about loops. (*EDIT: Forgot to mention the language... it's C )

    So, this post is to ask if you cuold shed me some light, without giving me the code right away, you see my little game below; I want to upgrade it.

    If you can give me a well detailed picture, I would appreciate since I need to learn, so neither a direct asnwer or formula would do.

    I want:

    1) The program to count the number of times the user tried a number before finding the random one.
    printf("Contrats, after % number of times, you found it", variable)

    2) I want the program to ask if the user want to try another game, using booleen (always true, false = endgame)

    and 3rd) I want it to be a 2 players game, someone enters the "random" number, and the other person tries to find it... BUT! We MUST be able to choose wether its gonna be a 1 player (random generated number) or 2 players.


    I need some help from you coders :shock2:

    Code:
    /*
    
    Less or More Mini-game-------------
    
    */
    
    
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    
    int main ( int argc, char** argv )
    {
        int guessNumber = 0, inputNumber = 0;
        const int MAX = 100, MIN = 1;
    
        // Generating the random number
    
        srand(time(NULL));
        guessNumber = (rand() % (MAX - MIN + 1)) + MIN;
    
        /* Loop of the program. It repeats until the user finds the guessNumber
        */
    
        do
        {
            // It asks for the number
            printf("What is the number ? ");
            scanf("%d", &inputNumber);
    
            // We compare the input number with the guessNumber
    
            if (guessNumber > inputNumber)
                printf("It's more !\n\n");
            else if (guessNumber < inputNumber)
                printf("It's less !\n\n");
            else
                printf ("Congrats, you found the mysterious number !!!\n\n");
        } while (inputNumber != guessNumber);
    
    }

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    So before you generate the random number, ask the player if it should be a two person game, or a one person game.

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    15
    I'd like to know some more

    How do I add the count thing ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 10-20-2009, 09:39 AM
  2. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. C++ Game of Life Program
    By rayrayj52 in forum C++ Programming
    Replies: 16
    Last Post: 09-26-2004, 03:58 PM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM