Design a simple card guessing game

Assignment Help Computer Engineering
Reference no: EM131774341

You are to plan a solution for the problem described below. Along with the tools that you have used in lectures and the workshops such as IPO charts, functions, condition/action and loop tables, create a solution to the problem. Your solution will be presented as a runnable flowchart and will be detailed in a planning document.

The Problem:

You are to design a simple card guessing game, played by one player against the computer.

The game will begin by asking the user for their name: "Hello, what is your name?", then welcome the player to the game saying "<name> welcome to the Card Guessing Game!"

The game will display 2 options for the user: "Play game (P) or Quit (Q)?" If the user choses "q" or "Q", the game will exit with a goodbye message: "Goodbye <name>!"

If the player choses "p" or "P", the game will begin with brief instructions: "You have 10 rounds to guess if the computer's card is higher or lower than yours. Good luck!"

If the player choses anything else, an error message will appear and the player will be asked to select again a correct option.

When playing, a game consists of 10 rounds; each round begins by showing the round number to the player "This is round 1 / 10". Then, the game will randomly generate two numbers, one for the player and one for the computer; the two cards are generated so that they are different in value. These numbers are whole numbers between 1 and 13, representing cards: Ace, 2 -10, Jack, Queen and King.
The player will then be told the value of their card with both the number and the name of the card (1 is an Ace, 11 is a Jack, 12 is a Queen, and 13 is a King). The player is asked to guess if the computer's card is higher or lower, by entering H or L: "Is the computer's card higher (H) or lower (L)?"

The player will have to make a guess by entering H or L; upper and lower case must be accepted, but any other input will result in an error and being asked again. Once the player has chosen, then the computer's card will be announced to the player. The player is told if he guessed right or not: "Well done, you guessed right!", or "Sorry, better luck next time." Keep in mind that the Ace (1) beats everything else.

At the end of the ten rounds, the player is informed how many rounds he guessed right: "<name>, you guessed right 4/10 rounds". Then, the game will exit with a goodbye message "Have a good day <name>!"

Example of How the Game Runs:
C: Hello, what is your name?
P: Fred
C: Fred welcome to the Card Guessing Game!
C: Play game (P) or Quit (Q)?
P: x
C: Incorrect option, please choose P for Playing the game or Q for Quitting. P: xyz
C: Incorrect option, please choose P for Playing the game or Q for Quitting. P: Q
C: Goodbye Fred.
C: Hello, what is your name?
P: Fred
C: Fred welcome to the Card Guessing Game!
C: Play game (P) or Quit (Q)?
P: p
C: You have 10 rounds to guess if the computer's card is higher or lower than yours. Good luck!
C: This is round 1 / 10. Your card is 2 Two.
C: Is the computer's card higher (H) or lower (L)? P: abc
C: Incorrect option, please choose H for Higher or L for Lower.
P: H
C: The computer's card is 11 Jack Well done, you guessed right!
C: This is round 2 / 10. Your card is 7 Seven.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 9 Nine. Sorry, better luck next time.
C: This is round 3 / 10. Your card is 10 Ten.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 1 Ace. Sorry, better luck next time.
C: This is round 10 / 10. Your card is 12 Queen.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 4 Four. Well done, you guessed right!
C: You guessed right 6/10 rounds. Have a good day Fred!

Planning:

You are to divide your solution into functions, following the principles shown in class. These may involve one for each menu option, as well as functions for parts of the program. For each function you are to provide an IPO chart listing all variables which are needed for your solution. In cases where selections are necessary, you must include a suitable condition action table directly below the IPO chart. You must also provide a loop description table for any loops needed in your plan.

Use the techniques and patterns that you have learned and seen demonstrated in class. Note that menu choice and other character selection should handle upper and lower case letters.

You also need to provide a flowchart with the complete game solution in Flowgorithm. Make sure that this flowchart and your planning document are consistent with each other!

You may show your assignment to your tutor during practical time to get comments or suggestions. It is important to note that you can only get help from staff in practical time after your practical work is finished.

Reference no: EM131774341

Questions Cloud

Discuss remote possibility of becoming an actual liability : A contingency was evaluated at year-end and considered to have a remote possibility of becoming an actual liability
Describe the impact an increase in aggregate demand : Draw two graphs, one with the LRAS curve and the other with the SRAS curve. Describe the impact an increase in aggregate demand will have in each situation.
Discuss the double-declining-balance method : Calculate depreciation for the second year using the double-declining-balance method of depreciation
Effects of proportional income tax on labor supply : Effects of Proportional Income Tax on Labor Supply . Suppose that the government imposes a proportional income tax on the consumer's wage income.
Design a simple card guessing game : CP5639 Problem Solving and Programming - create a solution to the problem. Your solution will be presented as a runnable flowchart and will be detailed in a pl
Calculate the npv of project : Megatech's after-tax cost of capital is 10%. Calculate the NPV of this project.
Prepare necessary journal entry to close overhead account : Prepare the necessary journal entry to close the overhead account if the balance is considered immaterial
Determining the theory of purchasing power parity : Explain the logic underlying the law of one price and the theory of purchasing power parity.
Prepare the journal entry to record income tax expense : Prepare the journal entry to record income tax expense, deferred income taxes, and income taxes payable for 2015

Reviews

len1774341

12/20/2017 3:34:21 AM

The flowchart provided is not consistent with other parts of the planning documentation and/or sonic steps are omitted_ Variables are missing from IPO charts, or unused variables are listed_ Decisions or loops are not correctly planned_ Most variables identified are appropriate and correctly used_ Most variable names are valid and meaningful Most functions are appropriate and correctly used Most of the inputs and outputs are correct. Most function names are valid and meaningful Most of the conditionals and loops used are appropriate and correctly used_ Most loops exit when appropriate and most decisions are correctly designed

len1774341

12/20/2017 3:34:14 AM

Appropriate use of problem- solving tools (including a flowchart, IPO charts and conditionlaction tables) to communicate the planned solution 10 The flowchart provided is based on other parts of the planning documentation and no steps are omitted. All variables are listed in IPO charts. Every decision has a ConditionlAction table and every loop is correctly planned Effective and correct use of variables in the planned solution 10 The variables identified are all appropriate and correctly used_ All variable names are valid and meaningful Effective and correct use of functions in the planned solution 10 The functions identified are appropriate and correctly used_ Function inputs and outputs are appropriate. All function names are valid and meaningful Effective and correct use of conditionals and loops in the planned solution. 10 The conditionals and loops used are appropriate and correctly used. All loops exit when appropriate and all decisions are correctly designed

len1774341

12/20/2017 3:34:07 AM

Exemplary (9— 10) Proposes strategies or partial solutions 10 The plan is completely correct and solves the problem. The solution handles all input scenarios correctly Largely conveys meaning to the audience, despite occasional lapses in sentence structure, grammar, punctuation and spelling. 10 Language used in planning document is clear_ Satisfactory (5 —6) Limited (2 —4) Poor (0 — 1) The plan mostly solves the problem, but there are many design flaws or missing elements_ Exhibits asp is ec o f exemplary (left) and satisfactory (right) No solution provided Language used in planning documents is generally understandable. There are mistakes in spelling and grammar_ Use of language in planning documents is incomprehensible or non-existent

len1774341

12/20/2017 3:33:51 AM

You will submit on LearnJCU: 1. The planning document: a MS Word document or PDF file, which contains: - A list of all functions in your solution (including main) with a brief (1-2 sentence) description of what each function does. - You will then have a section for EACH function, containing: o An IPO chart for each function; the input is the list of variables (if any) passed in to the function, and output is the variable (if any) returned from the function o A condition/action table for each conditional structure (if any) o The loop variable and exit condition for each loop used (if any) - Other document formats (OpenOffice files, etc) are not acceptable. 2. A runnable Flowgorithm file containing the card guessing game as described above. Please name the files like: FirstnameLastnameAl.docx or FirstnameLastnameAl.pdf e.g. if your name were Miles Davis, the filename would be MilesDavisAl.docx.

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