473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Pseudocode Help

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.

Jul 23 '05 #1
3 4028
<Lo****@aol.com> 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.
Jul 23 '05 #2
Unfortunately im not going to be programming in C++ so it's just the
pseudocode I need help with. Thanks for your time though.

Jul 23 '05 #3
"Rob.K" <Lo****@aol.com> 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.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: bearophileHUGS | last post by:
The free wikipedia is adopting a standard pseudocode: http://en.wikipedia.org/wiki/Wikipedia_talk:Wikicode/Specification MShonle says something nice: I support the idea of wikicode. Basically I...
0
by: Stefan | last post by:
I'm looking for some sort of tool that will allow me to present high level pseudocode in a way that looks similar to the way XML is presented in the browser. I would like to be able to collapse...
2
by: Krisitne | last post by:
I need to use a for statement to write some pseudocode. I am not sure how to actually write it - using a for loop. Could someone please give me an example of what a for statment would look like...
10
by: HK | last post by:
With VB.NET 2005, and a Windows Form, running on a dual CPU box, I need to take a recordset (e.g. 100,000 records) and spawn a thread to handle an internet XML transaction routine for each of the...
4
by: Vusi | last post by:
#include <err.h> #include <stdlib.h> #include <string.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <net/route.h> #include <net/if.h> #include...
6
by: anijenni | last post by:
1)what is mant by pseudocode?? 2)Develop a program based on pseudocode.....
2
by: Joah Senegal | last post by:
Hello all, I;m a beginner C++ and I;m trying to convert some pseudocode into C++. Its pseudo code of the peterson algorithm for N-processes. I almost converted the whole code. But the last...
7
by: popeyerayaz | last post by:
I want run this by the group for correctness. The question is as follows: 9. Present an example of a logic bug using pseudocode and explain your answer. (10 points) Temperature = 70 if...
1
by: milk242 | last post by:
So I have a program that asks the user to input their information and select services by entering 1 2 3 or etc. and it stores it as an array. This program also stores services it offers as a 2d...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.