Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

raptor with reverse loop logic. based around the procedue above, provided. -----the premise of this game is there are 4 cards--3 kings and 1 queen.

image text in transcribedraptor with reverse loop logic. based around the procedue above, provided. -----the premise of this game is there are 4 cards--3 kings and 1 queen. Your program will shuffle the cards at least 20 times, very briefly displaying the status after each shuffle. Then, the user must guess which card is the queen. You will put all of this in a loop so the user can play as many times as they like. I have provided a sample Raptor file in the project 2 section of the modules page so you can get an idea of how to create the array and display the cards. This example also illustrates how to use the Clear_Console and Delay functions in Raptor. The minimum program requirements are: InitCards procedure (cards array is the parameter variable) - Create a procedure that will use the Random function to generate a random number in the range 1 - 4. Then, use a loop to assign either a "K" or a "Q" to each element of the cards array. The "Q" will go in the index specified by the random number that was generated. ShowCards procedure (cards array is the parameter variable) - Provided for you, no changes necessary. up top ^^^ CheckUserGuess procedure (cards array is the parameter variable) - Create a procedure that will ask the user to guess where the queen is by inputting a number 1 - 4. Include an input validation loop that makes sure the user input is in the proper range. Then, use an If statement to determine if the user's guess is correct. Lastly, you can call ShowCards to display the final position of the cards so the user knows where the cards were. Main procedure - Begin by calling InitCards and then create a loop that iterates a minimum of 20 times. Each iteration of the loop should display the cards (call ShowCards), delay very briefly, clear the screen, then shuffle the cards (call InitCards). When this loop is finished, you will call CheckUserGuess to complete the game. All of this will be inside a Do...While loop that will ask the user if they want to play again. If the user selects yes, the game will repeat, if the user selects no, the game will exit.

main ShowCards main ShowCards Start Start (in cards) cards[1]? "K" count ? 1 cards[2)-"Q Loop eards[3]-"K countclength of (cards) cards[41--"K" Yes PUT"+cards[cout ShowCards(cards) delay_for(.2) count count1 Clear-Consolo PUT" .+cards count ShowCards(cards) End End main ShowCards main ShowCards Start Start (in cards) cards[1]? "K" count ? 1 cards[2)-"Q Loop eards[3]-"K countclength of (cards) cards[41--"K" Yes PUT"+cards[cout ShowCards(cards) delay_for(.2) count count1 Clear-Consolo PUT" .+cards count ShowCards(cards) End End

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions