Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

IMPLEMENTING THE CARD GUESSING GAME

Task:

You are to implement (code in Python) a computer game as outlined in the following description. Use what you have learned in class, including functions, selection, repetition and lists. You should use any feedback that you received from Assignment 1 to improve your program flow.

NB: The game is slightly different than the original one. Please read the description carefully and note the changes. The following functionality items must be added to your program and weren't in the original planning assessment:
- Game loop so that the player can play more than one game; a game no longer has 10 rounds
- Betting system - amounts in multiples of 5, balance of $0 forces quit
- Error handling for incorrect user input
- Appropriate code comments (each function should have a comment describing its purpose)
- Display overall amount won or lost on exit
- Make use of constants for variables with values that do not change

Program Features:

You are to design a simple guessing game, played by one player against the computer.
When the program begins it will ask the user for their name, then welcome them to the Guessing Game. The game will then begin, displaying the player's current balance (which starts at $100). The player will be asked how much they want to bet, which must be a whole number no less than 1, multiple of 5 and no more than their balance.

Once their bet has been entered the game will randomly generate two numbers, one for the player and one for the computer (they can be equal). These numbers are to be whole numbers between 1 and 13 (representing cards: Ace, 2 -10, Jack, Queen, King).
The player will then be told the value of their card as both a number (if the value is between 2 and

10) 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 will then choose whether they think the computer's card will be higher or lower, 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.

If the player was correct they get double their bet back (e.g. started with 100, bet 10 (balance is 90), win 20 (balance is 110). If the player was wrong they lost their bet (e.g. started with 100, bet 10 (balance is 90)), and if the two cards are equal then it's a tie (e.g. started with 100, bet 10 (balance is 90), get 10 back (balance is 100)) and the next round starts.

Each game follows the same pattern:
- Display balance
- Take the bet
- Reveal player's card
- Get player's guess
- Reveal computer's card

- Reveal winning/losing message
- Update balance

After each round the player can choose to continue, or quit. If the player's balance hits zero then the game ends, as if they had chosen to quit.

Once the game ends a farewell message will be displayed, noting the final balance and whether or not the player won (or lost) money overall.

Implementation:
- Python file:
You are to divide your solution into functions, following the principles shown in class. These may involve one for each menu option (other than Quit) as well as functions for parts of the program (e.g. calculating the current player balance could be implemented as a function).

- Planning document:
You also need to provide an updated version of your previous planning document showing an algorithm in pseudocode for each function, being sure to clearly indicate input and output variables for each. This should be based on your submission for Assignment One, with appropriate changes being made for new functionality.

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 prac work is finished.

Python, Programming

  • Category:- Python
  • Reference No.:- M92654262
  • Price:- $130

Guranteed 48 Hours Delivery, In Price:- $130

Have any Question?


Related Questions in Python

Foundations of programming assignment - feduni bankingthis

Foundations of Programming Assignment - FedUni Banking This assignment will test your skills in designing and programming applications to specification. Assignment Overview - You are tasked with creating an application t ...

Sieve of eratosthenes in pythonthe goal is to find all the

Sieve of Eratosthenes (in Python) The goal is to find all the prime numbers less than or equal to some natural number maxn. We have a list that tells us if any of the numbers 0..maxn are "marked". It can be an array of b ...

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Question write a simple python program that takes use

Question: Write a simple python program that takes use inputs as non-zero digits and converts them into binary form. The response must be typed, single spaced, must be in times new roman font (size 12) and must follow th ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Question a software company sells a package that retails

Question : A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program usi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As