Answered step by step
Verified Expert Solution
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 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, ie c irclerianglequareectangleentagon
store it in a variable named randnumber.
import random
randnumber random.randint
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 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 checkguess findpositionshape etc.
There are four important pieces of information you may wish to store:
secretarrangement: The arrangement to guess.
playerguess : The inputted guess of the player.
guessesremaining: The number of guesses the player has left. The player is given guesses.
Use print statements at appropriate locations to see the flow of your program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started