0

Dont know HOW TO DO A PSEUDOCODE REALLY REALLY NEED HELP ON THS QUESTION!

Imagine a computer randomly selects a card from a pack of cards. You have to guess what card it is. You have to guess the suit first then its value. After each guess for the suit a message will be displayed to indicate whether your guess was successful or not. Simarly every guess for the value of suit will generate a message indicating whether the value is correct, too low or too high.

The game ends when you have correctly identified the card selected by the computer.

At the completion of playing 5 games the average number of guesses to correctly identify a card for that named individual will also be displayed together with an invitation to play the game again.

I really need a simple pseudocode of this solution

Please could someone help if they have any idea how to do this!

9
Contributors
8
Replies
10
Views
12 Years
Discussion Span
Last Post by Enceladus
0

Pseudocode is half-code, half-english. Basically, it is the algorithm that you use to solve the task at hand, without worrying about the intricate language syntax.

For more information, read the article here: http://www.daniweb.com/tutorials/tutorial1731.html and all of the comments that follow it.

Here is how to find the solution ...

Read the question.
Decide what the question is asking for.
What is needed to solve the problem?
What is the input? What is the output?
How is the problem going to be solved?
Is there a formula? What is the formula?

Answer all of those questions ... put them all together ... and you have pseudocode.

0

Imagine something like:

. . . 
set Suit = random value 1..4
set Card = random value 1..13 // ace, 2..10, j, q, k
set input-suit to 0
while Suit != input-suit
    ask for suit as input-suit

expand that to the whole problem and *poof* ... pseudocode.

Remember that the purpose of pseudocode is to give more detail than an English description of the problem, but not to write actual compilable code (i.e. you could take the pseudocode and code it an any of several languages).

You can gloss over syntactic details of a given language, but you should not gloss over the process you intend to follow; like don't assume variables would be initialized - write pseudocde to do it.

From the pseudocode, someone who knows nothing of the English description should be able to write code to do what was asked.

0

Dont know HOW TO DO A PSEUDOCODE REALLY REALLY NEED HELP ON THS QUESTION!

Imagine a computer randomly selects a card from a pack of cards. You have to guess what card it is. You have to guess the suit first then its value. After each guess for the suit a message will be displayed to indicate whether your guess was successful or not. Simarly every guess for the value of suit will generate a message indicating whether the value is correct, too low or too high.

The game ends when you have correctly identified the card selected by the computer.

At the completion of playing 5 games the average number of guesses to correctly identify a card for that named individual will also be displayed together with an invitation to play the game again.

I really need a simple pseudocode of this solution

Please could someone help if they have any idea how to do this!

Haha, i remember this class. It was in my AP Programming class in high school using borland C++. Then again i could never really understand why we used pseudocode, i personally hated it...

0

Open device 1, human_memory
Open device 2, pencil_and_paper
indent_level = 0
Repeat
Get 1, next_task
code_line$ = Convert_to_code (next-task)
Call Hungarian (code_line$, indent_level, indent_string$) by reference
Print 2, indent_string$, code_line$
Until EOF(1)
Close All
Exit

-1

I need Help writing in pseudocode...please

A program is to be developed that will calculate the total length of music to be stored on a CD. Assume a CD may store 76 minutes of music. The user will enter the length of musical tracks in minutes and seconds (separately) in a loop. A loop will be used to prevent the user from entering a negative value for the minutes value; and a loop will be used to force the user to enters a seconds value in the range of 0 to 59 inclusive. The length of each track will be added to the sum of minutes and seconds that are stored on the CD. If the number of seconds, when summed, exceeds 59, add one to the minutes value and adjust the seconds accordingly.

After the length of each track is entered, the user will be asked if they wish to enter another track. If the user responds with no, then the sum of the time will be displayed. If the user answers yes, then another track will be entered only if the current sum is less than 76 minutes. If the current sum exceeds 76 minutes, track input will end, and the total sum will be displayed. After the total sum of the time is displayed, the program will end.

0

Pseudo code is just a narrative step by step procedures in solving a problem. You just have to analyse the problem(what the problem wants), then list all the steps required.
But remember, pseudo code is not a computer program but it takes some elements from computer programs.

example: Display question;
Set count to zero;
accept response;
if response=YES or count>20 then halt

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.