Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Guessing Game A guessing game is a classic and fun way to engage users and challenge their guessing skills. In this assignment, you are

The Guessing Game
A guessing game is a classic and fun way to engage users and challenge their guessing skills. In this assignment, you are asked to create a simple guessing game using Python.
In this game, five shapes (say, Circle, Triangle, Square, Rectangle, Pentagon) are randomly arranged, and the player will have to guess the correct arrangement of the shapes in five (5) attempts.
computer will print the answer along with the number of attempts.
The Game Logic
The Guessing Game revolves around a few key elements:
Generating a Random Arrangement of the Shapes: The game will randomly arrange the shapes, which the player has to guess.
Hint:
you can represent the shapes using its first letter, i.e. c (ircle),t(riangle),s(quare),r(ectangle),p(entagon)
store it in a variable named randnumber.
import random
randnumber = random.randint (1,5)
User Interaction: The player will be asked to enter his name, making the game more personalized. Then, he can begin guessing the shapes' arrangement.
Hint:
Check the player's input for correct shapes, length and completeness.
he loses a warning. If the player has no warnings left and enters an invalid input, he would lose a guess.
Feedback Loop: After each guess, the computer will provide feedback on whether a shape is in the correct position or is adjacent to the correct position. This will guide the player in making his subsequent guesses.
Limited Attempts: The player is given a maximum of 5 attempts to guess the correct arrangement. Can you solve the arrangement within these attempts?
reveal the correct arrangement.
General Hints:
Choose an appropriate data structure to represent an arrangement (a list ?).
Consider writing helper functions - check_guess(), find_position(shape), etc.
There are four important pieces of information you may wish to store:
secret_arrangement: The arrangement to guess.
player_guess : The inputted guess of the player.
guesses_remaining: The number of guesses the player has left. The player is given 5 guesses.
Use print() statements at appropriate locations to see the flow of your program.
image text in transcribed

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions