Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PROGRAMMING QUESTION Boom is a classic word or phrase guessing game with limited tries and something catastrophic if the word is missed - a
C++ PROGRAMMING QUESTION
Boom is a classic word or phrase guessing game with limited tries and something catastrophic if the word is missed - a firecracker goes (you guessed it) "Boom!". A game in progress looks something like the screen shot to the right asi i i e sa es i e: I Below is a simple UML class diagram of the Full Credit version of the game. Note that Main isn't actually a class it's simply the usual main function This time around, implement a .h and .cpp for each class (as discussed in Thursday's lecture) The Puzzle class represents the game. The_solution field1 is the string that is the word or phrase the player is trying to guess. The -guesses array (like a vector, but without methods) holds a Boolean for each ASCII character. For example-guesses[a] is true if a has been guessed, false if not. ain + main: int Puzzle Fuse string me: int The Puzzle constructor accepts the solution, which should be stored in Puzzle(solution: string solution. The guess method accepts +guess(c: char): bool a single character (the player's guess), and returns true if the character is valid (between a and 'z', and not yet guessed) and false otherwise. It should also update_guesses. The solve method accepts a proposed solution, and returns true if correct (it matches_solution) or false if incorrect. The to_string method returns the player's view of the puzzle - that is, characters that have been guessed are visible, those that have not been guessed are replaced with a '_', and spaces are not changed. The get solution getter method simply returns_solution. guesses 255]: bool time int + burn(): bool + to strin strin + solve(proposed solution: string): bool + to string): string + get solution): strin The Fuse constructor accepts the time (i.e., number of guesses) that may elapse before the firecracker goes boom. The burn method decrements the remaining time, and returns true if any time remains or false if time has expired. The to_string method returns an ASCII art representation of the firecracker with the number of segments of fuse representing the time (aka number of guesses) remaining 1 For all fields, you may use or omit the leading underscore, as you please. The UML omits them
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