Pseudocode Help

Discussion in 'C++' started by Lobbo1@aol.com, Mar 12, 2005.

  1. Guest

    Hi,
    Im a computing student and need help with some pseudocode. The
    following is what I have got so far...

    SET point_value = 10
    SET suit_value = Hearts
    SET point_valueA = suit_valueA = guess_count = game_count = = 0
    REPEAT
    OUTPUT message to operator for suit_valueA
    GET suit_valueA
    IF suit_valueA == suit_value THEN
    OUTPUT message indicates successful guess
    ELSE
    OUTPUT message indicates incorrect guess
    END IF
    UNTIL suit_valueA == suit_value
    REPEAT
    OUTPUT message to operator for point_valueA
    GET point_valueA
    IF point_valueA == point_value THEN
    OUTPUT messages indicates successful guess
    ELSE
    IF point_valueA < point_value THEN
    OUTPUT message indicates guess to low
    ELSE
    OUTPUT message indicates guess to high
    END IF
    END IF
    UNTIL point_valueA == point_value

    The code is for a game which goes by the following rules...

    1) Imagine computer randomly selects a card from a pack of cards.
    2) The first player must guess the suit then its value
    3) After each guess for the suit a message will display whether the
    player was correct or not.
    4) After each guess for the value a message will display whether the
    player was correct, too high or too low.
    5) The individual game ends when a player has correctly identfied the
    card, the next player is now given a new card.
    6) On completing 3 games each the average number of guesses to
    correctly identify the card should be displayed for each player.
    7) The game should be restricted to three players.

    So basically I have completed the first 4 steps but need help editing
    my code to include rules 5, 6 and 7.

    Any help at all would be very much appreciated.

    Many Thanks,

    Rob.
     
    , Mar 12, 2005
    #1
    1. Advertising

  2. osmium Guest

    <> wrote:

    > Im a computing student and need help with some pseudocode. The
    > following is what I have got so far...
    >
    > SET point_value = 10
    > SET suit_value = Hearts
    > SET point_valueA = suit_valueA = guess_count = game_count = = 0
    > REPEAT
    > OUTPUT message to operator for suit_valueA
    > GET suit_valueA
    > IF suit_valueA == suit_value THEN
    > OUTPUT message indicates successful guess
    > ELSE
    > OUTPUT message indicates incorrect guess
    > END IF
    > UNTIL suit_valueA == suit_value
    > REPEAT
    > OUTPUT message to operator for point_valueA
    > GET point_valueA
    > IF point_valueA == point_value THEN
    > OUTPUT messages indicates successful guess
    > ELSE
    > IF point_valueA < point_value THEN
    > OUTPUT message indicates guess to low
    > ELSE
    > OUTPUT message indicates guess to high
    > END IF
    > END IF
    > UNTIL point_valueA == point_value
    >
    > The code is for a game which goes by the following rules...
    >
    > 1) Imagine computer randomly selects a card from a pack of cards.
    > 2) The first player must guess the suit then its value
    > 3) After each guess for the suit a message will display whether the
    > player was correct or not.
    > 4) After each guess for the value a message will display whether the
    > player was correct, too high or too low.
    > 5) The individual game ends when a player has correctly identfied the
    > card, the next player is now given a new card.
    > 6) On completing 3 games each the average number of guesses to
    > correctly identify the card should be displayed for each player.
    > 7) The game should be restricted to three players.
    >
    > So basically I have completed the first 4 steps but need help editing
    > my code to include rules 5, 6 and 7.


    I don't know what your instructions are. But since you are posting to C++,
    I presume the end result will be a C++ program. I would much prefer writing
    the program to writing the pseudocode. I would have a class called player
    and it would keep score and divulge the score when asked. It would have a
    command called play which has a parameter describing the card. There would
    be three player objects and each player would receive three calls on
    play().

    Main would create the objects, select the cards, issue the play function,
    and collect and display statistics at the end of the program.
     
    osmium, Mar 13, 2005
    #2
    1. Advertising

  3. Rob.K Guest

    Unfortunately im not going to be programming in C++ so it's just the
    pseudocode I need help with. Thanks for your time though.
     
    Rob.K, Mar 13, 2005
    #3
  4. "Rob.K" <> wrote...
    > Unfortunately im not going to be programming in C++ so it's just the
    > pseudocode I need help with. Thanks for your time though.


    Try news:comp.programming.
     
    Victor Bazarov, Mar 13, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan
    Replies:
    0
    Views:
    1,825
    Stefan
    Apr 15, 2004
  2. Krisitne

    Pseudocode For Statement

    Krisitne, Sep 13, 2003, in forum: C Programming
    Replies:
    2
    Views:
    561
    Malcolm
    Sep 13, 2003
  3. Replies:
    8
    Views:
    2,560
    Sunnan
    Apr 2, 2005
  4. Ivan Van Laningham

    Re: Pseudocode in the wikipedia

    Ivan Van Laningham, Apr 1, 2005, in forum: Python
    Replies:
    2
    Views:
    359
    Ivan Van Laningham
    Apr 2, 2005
  5. PeterL

    help to translate my pseudocode to asp

    PeterL, Apr 29, 2004, in forum: ASP General
    Replies:
    11
    Views:
    253
    PeterL
    May 3, 2004
Loading...

Share This Page