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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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