Write a program for class presents the game

Assignment Help Computer Engineering
Reference no: EM132212162

Write a program, for W_bubble class presents the game. The _solution field 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. The W_bubble constructor accepts the solution, which should be stored in _solution. The guess method accepts 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 W_bubble - 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.

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 as 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.

Main will implement the following algorithm:

(1) Create the variables.

(2) Display a welcome message, like this:

************************

Word Bubble

************************

Enter lower case letters to guess,

! to propose a solution,

0 to exit.

(3) Begin the main loop:

(3a) Display the firecracker and the player's view of the puzzle, with a prompt, something like this:

(3b) Accept a character from the player. If it's a 0, immediately exit. If it's an exclamation point (!), ask for a proposed solution: If correct, they win, if not, they lose. If the character is an invalid guess, print "Invalid character - try again". Otherwise, update the state of the puzzle using the player's guess, including decrementing the length of the fuse.

(4) After a proposed solution, or if the firecracker explodes, display something like this if the player

won:

*** YOU WON ***

and something like this if the player lost:

*** Word Bubble ****

The answer was: Bob the builder

Reference no: EM132212162

Questions Cloud

Discuss the purpose and components of production strategy : What is production system? Discuss the purpose and components of a production strategy. Would you consider a production strategy to be strategic, or tactical?
Demonstrate professional communication in the content : You must use the rubric to direct the creation of your submission because it provides detailed criteria that will be used to evaluate your work.
Calculate a simple equation in mutiplication : Write a programme in java about says that I wanted to be a professional programmer and I wanted to be a bussiness man!
Most of students are from the same ethnic-religious group : You're a third grade teacher. Most of the students are from the same ethnic-religious group; three, however, are from a different group.
Write a program for class presents the game : Write a program, for W_bubble class presents the game. The _solution field is the string that is the word or phrase the player is trying to guess.
What forms does quality take in a fast-food restaurant : What forms does quality take in a fast-food restaurant? That is what aspects of the food, service, atmosphere and so on do you consider to be acceptable.
The differential effects of technological change : Chapter Two of Society and Technological Change: Winners and Losers: The Differential Effects of Technological Change.
Apply ethical theory covered within the unit reading : Apply an ethical theory covered within the unit reading or in previous units to justify your course of action for resolving the issue.
Research the growth opportunities in the industry : Research the growth opportunities in the industry, competitive strategies that were employed, typical customers, and other relevant information related.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What would a call to minimum look like

What would a call to Minimum look like if the actual parameters are a variable called Deductions and the literal 2000?

  Show the operation of the pipeline using a reservation table

Design a pipeline ALU that can add two 8-bit integers. Assume that each stage can add two 2-bit integers and employ sufficient number of stages.

  What is the link utilization

Consider a TCP connection between two hosts that are 400 miles away from each other (propagation delay is 100 miles per msec.).

  Design a database solution and the potential business rules

Design a database solution and the potential business rules that could be used to house the sales transactions of the department store.

  Write a program to store the product of the two arrays

Write a program to store the product of the two arrays in the third array. Produce a display using the MessageBox class that shows the contents of three arrays.

  How technology is destroying jobs

Has the use of technology made it easier or harder for you to find work? Provide examples. Name at least three fields that technology has decreased the number.

  Explain the operation of the modified register

One input of the NAND gate receives the clock pulses from the clock-pulse generator. The other input of the NAND gate provides a parallel-load control. Explain the operation of the modified register.

  What oss support each standard

What OSs support each standard? Does either standard have a clear advantage in any market segments or for specific types of applications?

  How you used the knowledge gained in the cryptography

How you used the knowledge gained in the Cryptography and physical security courses and also how you applied the principles in your intern(or at work).

  Implementing the callback function using mouse and keyboard

Implementing the Callback Function using Mouse and Keyboard. The goals of assignment are to familiarize yourself with the OpenGL command of rendering pipeline

  How you would set up the security of the database to enforce

describe how you would set up the security of the database to enforce the restrictions described. You must use at least one role.

  Java program that allows a user to enter three words

design a Java program that allows a user to enter three words, and displays the appropriate three-letter acronym (constructed from the input) in all uppercase letters. If user enters more than three words, ignore the extra words.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd