473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4040
<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.progr amming.
Jul 23 '05 #4

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

Similar topics

8
2624
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 think we should present code in a Python-like language that doesn't carry so much baggage. For example, we can use English sentences (or sentence fragments) instead of requiring the reader to understand some obscure Python library. (Further,...
0
1898
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 and expand blocks of code (IFs, LOOPs, Functions, etc...). It must be relatively easy to use as it will be used by people who have relatively minimal technical knowledge. Is there something like this out there? Thanks,
2
8592
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 in pseudocode? Thankyou --
10
1682
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 records. This is a nice use of threading because those internet requests are going against 3rd party servers that often have 1 second latency problems and so handling them with multiple threads is the fastest way to get through all the records in...
4
2020
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 <netinet/in.h> #include <arpa/inet.h>
6
2930
by: anijenni | last post by:
1)what is mant by pseudocode?? 2)Develop a program based on pseudocode.....
2
3055
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 lines are very hard. This is the pseudo code: for
7
2470
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 (Temperature >69) and (Temperature < 100 ) THEN
1
1681
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 array with column one as the service name and column two as the cost of service. I would like to be able to grab a customer from the array and see which services the customer chose then calculate the total cost of the services he chose. Here is...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.