In this project, you will demonstrate your mastery of the following competency:
Use flowcharts and pseudocode to describe and develop programming logic
Recall that you are applying for a position as a software developer for a company that develops educational games for children. As part of the application process, the company has given you three different possible programming problems, from which you are responsible for selecting one to solve.
Prior to developing the Coral program for the programming problem you choose, the company would first like to see your flowchart design and the written pseudocode that you would use to guide your later work on the code. While flowcharts are very useful for walking through the logic of a program, pseudocode is more widely used in industry, so it will be important to develop both.
The three possible programming problems are as follows:
1. Cracked Egg Game:There are a dozen eggs in a basket; some are hard boiled and some are raw. The object of this game is for the user to guess the number of hard-boiled eggs prior to playing the game. The computer then simulates cracking all 12 eggs, using a random number 0 or 1 to simulate raw or hard boiled. The number 0 should represent raw eggs and the number 1 should represent hard boiled. The computer must keep track of the number of hard-boiled eggs. At the conclusion of cracking all 12 eggs, the actual number of hard boiled is compared to the users guess, and whether the user won or lost is given as output.
1. Spaceship Race:There are two spaceships racing across the galaxies toward a distant star. The spaceships make progress by getting a “boost,” or a value between 0 and 10. The first spaceship to reach the distant star wins. The distance of the star the spaceships are racing toward is provided as input by the user (a value between 25 and 100). The boost value is determined from the computer generating a random number between 0 and 10. The object is to have the spaceships race, and then as soon as one spaceship reaches the destination, which spaceship won or if there was a tie is provided as output.
1. Rock-Paper-Scissors:This is a game of chance normally played between two people. Similar to flipping a coin or drawing straws, it can be used as a method for determining a random winner. The rules of the game require that each player forms one of three shapes with their hand at the same time. The shapes are as follows:
Rock, which is represented by a closed fist, will beat scissors because rock can crush scissors.
Paper, which is represented by a flat hand, will beat rock because paper can cover rocks.
Scissors, which are represented by the index and middle fingers forming a V, will beat paper because scissors can cut through paper.
In the computer version of this game, the user will play against the computer. The human user will choose rock, paper, or scissors, and the computer will also randomly choose rock, paper, or scissors. Use the integer value 1 to represent rock, 2 to represent paper, and 3 to represent scissors. The human user will input either 1, 2, or 3. The computer will then choose a random number between 1 and 3. Based on the rules of the game, the computer will give output to show whether the user or the computer wins the game, or if it is a tie. The user will play 10 games and, at the conclusion of those 10 games, the computer will output the number of times the user won, the number of times the computer won, as well as the number of tied games.
In this project, you will not be doing any programming. Using the flowchart and pseudocode from this project, you will later implement a program using Coral for Project Two.
This project will consist of two deliverables: a final flowchart that illustrates the logic of your solution and a pseudocode description of the flowchart logic. You have already selected a game and created a first draft of the flowchart in a previous milestone. Now you will continue work on the game you have already begun; be sure to focus on implementing feedback for your flowchart before moving on to developing the pseudocode.
Finalize a flowchart that follows the solutions logic and works through a sequence of steps for the game you have selected. As the three programming problems are quite different, the flowcharts will be different as well. But for each flowchart, you should have between approximately 15 and 20 steps.
1. Illustrate the appropriateinputs and outputsfor your selected game. Recall that you will need the following from a user in order to begin the game:
Cracked Egg Game: Obtain the users guess for the number of eggs that are hard boiled.
Spaceship Race: Obtain the distance of the star that the spaceships are racing toward.
Rock-Paper-Scissors: Obtain the users selection of rock, paper, or scissors (1, 2, or 3).
1. Designconditionals(branches) to establish the logic of the solution for your selected game. Each path should have an outcome that makes sense with the logic of the solution. The paths should be easily represented and readable. The appropriate branches for each game are as follows:
Cracked Egg Game: Two IF statements will be required for this game. You will need one to determine if the cracked egg is hard boiled or raw. Then you will need a second IF statement to determine if the user correctly guessed the number of hard-boiled eggs at the conclusion of the game.
Spaceship Race: One IF statement will be required at the conclusion of the game to determine which spaceship won the race, or if it was a tie.
Rock-Paper-Scissors: There will be multiple IF statements determining whether the human user or computer won a game or if it was a tie, based on the rules for rock-paper scissors. For one round, you will use IF statements to account for what happens when a user chooses each option and when the computer chooses each option.
1. Design appropriateloopsto establish the logic of the solution. For each game, the loops you will need are slightly different. The following provides additional guidance for each:
Cracked Egg Game: As it is known in advance how many times this is played, a FOR loop will be an appropriate loop for this game.
Spaceship Race: The Spaceship Race game is played until one of the spaceships reaches the distant star, so a WHILE loop will be more appropriate for this game.
Rock-Paper-Scissors: As it is known in advance how many times this is played, a FOR loop will be an appropriate loop for this game.
1. Apply correctsymbolsto convey the intent of the logic in the flowchart. Each node in your flowchart will need to be identified with the proper symbol. Focus on the following symbols:
Oval: Indicates the end or beginning
Rectangle: Indicates a step in the flowchart process
Diamond: Indicates a decision or conditional
Parallelogram: Indicates input and output
Arrows: Indicate directional flow
1. Implementfeedbackto improve the design. Make sure your flowchart is as finalized as possible before beginning to develop pseudocode. Look over and implement any instructor feedback that you received from your previously submitted milestone. This will help ensure that you have an overall clear and correct design.
Based on the logic in your completed flowchart, you will next express the flowchart by writing it as a series of numbered steps in pseudocode. This pseudocode should be written in plain language, not in Coral code.
1. Applyplain languageto design the flow and logic of the game. Be sure you are writing out your pseudocode using simple sentences that are clear to read and understand. The work you do will be completed in a series of numbered statements corresponding to obtaining the required input and output, necessary branches, and loops.
1. Create pseudocode statements for appropriateinputs and outputs. This should match your flowchart. Make sure you have an appropriate output message at the conclusion of each game.
1. Develop statements that evaluate user input and execute instructionslogically. These statements will involve IF statements to provide branching, using appropriate conditionals based on the required logic to play the game. Be sure to reference your flowchart as you work since all the information you need should already be outlined there. Review the following for reminders on the IF statements you will use in your game:
Cracked Egg: Your input would be a numeric guess.
Spaceship: Your input would be the distance.
Rock-Paper-Scissors: Your input would be your choice.
1. Develop statements that indicateloopsto appropriately control program flow. These statements will require using either FOR or WHILE loops. Your flowchart should already outline which to use, so be sure to check your previous work in this area.
What to Submit
To complete this project, you must submit the following:
Complete your flowchart in Lucidchart, and then submit the downloaded version of the flowchart. Refer to the guidance in the Lucidchart Tutorial, linked in the Supporting Materials section, for additional support in using Lucidchart. Also remember to make any updates to your original flowchart design based on feedback you received from your instructor.
Submit a numbered, step-by-step series of statements written in pseudocode that reflects the logic in your flowchart. This may be submitted as a Microsoft Word document.
The following resource(s) may help support your work on the project:
Refer to the tutorial if you have any questions about how to create a Lucidchart account as well as how to create different types of documents and diagrams.