For this phase of the project, you are to implement a working version of the game. If the user guesses the secret-code i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

For this phase of the project, you are to implement a working version of the game. If the user guesses the secret-code i

Post by answerhappygod »

For This Phase Of The Project You Are To Implement A Working Version Of The Game If The User Guesses The Secret Code I 1
For This Phase Of The Project You Are To Implement A Working Version Of The Game If The User Guesses The Secret Code I 1 (232.08 KiB) Viewed 29 times
For this phase of the project, you are to implement a working version of the game. If the user guesses the secret-code in eight (8) guesses, (s)he wins, otherwise, the game is lost. Here is a list of functions that would be helpful for this phase. 1. A function called guess_is_right to determine whether the four colors that the code- breaker has selected (the guess) and the secret code match. If this function returns true, then the code-breaker has succeeded guessing the secret-code and thus has won the game. def guess_is_right(secret_code_colors, guess_colors): Returns True if the corresponding elements of secret_code_colors and guess_colors match. secret_code colors: a list of colors guess_colors: a list of colors where len (secret_code_colors) == len(guess_colors) is true return value: True if the corresponding element of the two lists are equal. Otherwise, the function returns False 2. A function called create_feedback_skel to create four smaller circle to be used as feed- back circle after the code-breaker has entered a guess. def create_feedback_skel(): : HHH Creates four smaller circles such that when drawn, they form two rows each of which includes 2 circles. return value: a list of four circles 3. The implementation for following function has been posted on the projects tab of the web-pages for this class. def create_feedback_circles(secret_code_colors, guess_code_colors, feedback_skel_circles): Compares secret_code_colors and guess_code_colors and based on the outcome, it creates zero to four circles. secret_code_colors: a list of 4 colors that represent the secret code guess_code_colors: a list of 4 colors that represent the code-breaker's guess feedback_skel_circles: a list of 4 circles to be used as a model to create feedback 4 a circles. For example, if the guess colors were to give rise to two feedback circles, this function clones the first two circles in feedback_skel_circles, "color" them appropriately, and returns them. The original feedback_skel_circles will not be modified in any way by this function. return value: a list of as few as O and as many as 4 circles.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply