Okay, so I've been doing practice with pseudocode in order to get ready for the exams at school but I'm stuck on one of the practice tasks and am scared that if I can't pass this I wont be able to even do the actual exam itself.... keep in mind I'm very new to pseudocode.
Okay so the task is to:
Task
Basic requirements: You are to write the pseudocode for a random quotes program. Quotes stored in an array are to be randomly chosen and displayed in the output window. You must use at least three functions:
One that gets a random quote
One that displays the quote
The draw function from which other, but possibly not all, functions are called.
Here is a link to a video clip that shows a possible more advanced version of the coded up program, displays inspirational quotes: Possible program
As can be seen a random inspirational quote is displayed every half-second or thereabouts from a range of set quotes. The font is chosen randomly from a range of fonts, and a font size is likewise randomly chosen from a range of sizes. In addition they are in different colours chosen at random from a range of colours, and they all fit within the output window.
Note: It is more likely that you will get a better grade if you choose to go beyond the basic requirements of the program.
This is what I've gotten so far:
// When the mouse is clicked this program displays a random quote from a list of arrays. The quotes are displayed on the output window//
Input:
mouse presses
array of quotes
Output:
quotes displayed randomly on the screen
Variables:
arrays: quotes, array of strings, predictions
number: quote numbers
color: textColor
Boolean: mouseIsPressed
Functions:
// This function displays a quote at centreX and centreY//
FUNCTION drawQuote (Parameters: centerX, centerY, quote)
set textColor (random color)
set textSize (5)
draw the quote at centerX/centerY with textSize
END FUNCTION
// This function gets a quote from the quotes array//
FUNCTION getQuote (Parameters: none)
set textColor (random color)
set textSize (5)
draw the quote at centerX/centerY with textSize
END FUNCTION
Functions:
FUNCTION getPrediction(Parameters: none)
Set index to a random number between 0 and the length of the predictions array minus 1
Set quote to the element in the predictions array at index position
RETURN prediction
END FUNCTION
FUNCTION drawText(parameters: prediction)
Set fill color to white
Set text size to 5
Set text align to center
Use text function to draw
Prediction
END FUNCTION
// This function draws the background//
FUNCTION drawBackground(Parameters: none)
Draw black background
Set fill colour to black
END FUNCTION
FUNCTION mousePressed(Parameters: none)
Set prediction to CALL getPrediction()
CALL drawQuote(prediction)
END FUNCTION
Processing:
Start when mouse is pressed
Test items:
When mouse clicked a random quote is displayed in the output window.
Over time different ones are displayed.
When any key pressed nothing happens.
Pretty much I need to polish it up. Please help guys!
Question
lolman
Okay, so I've been doing practice with pseudocode in order to get ready for the exams at school but I'm stuck on one of the practice tasks and am scared that if I can't pass this I wont be able to even do the actual exam itself.... keep in mind I'm very new to pseudocode.
Okay so the task is to:
Task
Basic requirements: You are to write the pseudocode for a random quotes program. Quotes stored in an array are to be randomly chosen and displayed in the output window. You must use at least three functions:
One that gets a random quote
One that displays the quote
The draw function from which other, but possibly not all, functions are called.
Here is a link to a video clip that shows a possible more advanced version of the coded up program, displays inspirational quotes: Possible program
As can be seen a random inspirational quote is displayed every half-second or thereabouts from a range of set quotes. The font is chosen randomly from a range of fonts, and a font size is likewise randomly chosen from a range of sizes. In addition they are in different colours chosen at random from a range of colours, and they all fit within the output window.
Note: It is more likely that you will get a better grade if you choose to go beyond the basic requirements of the program.
This is what I've gotten so far:
Link to comment
Share on other sites
3 answers to this question
Recommended Posts