Details of this Paper

Python Steal Or Deal and Caesar Encrypting/Decryption

Description

solution


Question

There are two parts;Part I: Steal or Deal?;You are required to write a Python program that allows a player to play a game of Steal or Deal against the computer. The program will allow a player to play at most 10 games of Steal or Deal but the player can stop before he/she has reached his/her 10 game limit. Once the player chooses to stop playing or the player has played 10 games, the program will report the game statistics to the screen.;Part II: Encryption;You are required to write a Python program that performs simple encryption and decryption on strings entered by the user. To do so, you are to use one of the simplest and most widely known encryption techniques known as the Caesar Cipher. The Caesar Cipher is named after Julius Caesar who used it for private correspondence.;STAGES (PART I);It is recommended that you develop this part of the assignment in the suggested stages. Each stage is worth a portion of the marks. Many problems in later stages are due to errors in early stages.;The following stages of development are recommended;Stage 1;To begin, display the jackpot to the screen and prompt for and read the player?s choice. Display the player?s choice to the screen as seen below (the ?C:? stands for choice).;Sample output 1;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal;Sample output 2;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal;Make sure the program runs correctly. Once you have that working, back up your program. Note: When developing software, you should always have fixed points in your development where you know your software is bug free and runs correctly.;Stage 2;Add code to generate the computer?s choice. Use the random.choice("sd") or random.randint(1,2) function to simulate the computer?s choice. Display the computer?s choice to the screen as seen below. Don?t worry too much about formatting the output at this stage, just make sure that the values are correct.;Sample output 1;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Steal;Sample output 2;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;Sample output 3;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Steal;Sample output 4;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal 8 of 36;Stage 3;Add code to determine whether the player wins, loses or draws with the computer. Display the score and appropriate message to the screen according to the following rules of play;If both players (computer and human) choose to make a deal to share the jackpot, the jackpot is split equally between both players and they both receive half the money. i.e. $50 each. The following message is displayed to the screen: Draw! Split pot!;If the human player chooses steal the jackpot and the computer player chooses to make a deal to share the jackpot, the human player receives all the money and the computer player who chose to make a deal receives none. The following message is displayed to the screen: You win! Jackpot!;If the computer player chooses steal the jackpot and the human player chooses to make a deal to share the jackpot, the computer player receives all the money and the human player who chose to make a deal receives none. The following message is displayed to the screen: You lose! You get nothing!;If both players (computer and human) choose to steal the jackpot, they both receive nothing. The following message is displayed to the screen: Too greedy! You get nothing!;Display the score and appropriate message to the screen as seen below (the ?S:? stands for score);Sample output 1;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Steal;S: 0 | 0;Too greedy!;You get nothing!;Sample output 2;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;S: 100 | 0;You win!;Jackpot!;Sample output 3;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;Sample output 4;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Steal;S: 0 | 100;You lose!;You get nothing!;Don?t worry too much about formatting the output at this stage, just make sure that the values are correct. 9 of 36;Stage 4;Now? it?s time to allow the player to play more than one game. Let?s add a loop which loops until the user either enters 'q' (to quit the game) or the 10 game limit is reached. Think about where this code should go ? what needs to be repeated, etc. Don?t worry too much about formatting the output at this stage, just make sure that the values are correct.;Sample output 1;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;S: 100 | 0;You win!;Jackpot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Steal;S: 0 | 0;Too greedy!;You get nothing!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Steal;S: 0 | 0;Too greedy!;You get nothing!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Steal;S: 0 | 100;You lose!;You get nothing!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s 10 of 36;C: Steal | Steal;S: 0 | 0;Too greedy!;You get nothing!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;S: 100 | 0;You win!;Jackpot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Steal;S: 0 | 100;You lose!;You get nothing!;Game limit reached.;Sample output 2;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;S: 100 | 0;You win!;Jackpot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;Jackpot: 100;Steal, Deal or Quit [s|d|q]? q;Stage 5;Modify your code to keep a cumulative total of the winnings of both the player and the computer player.;If both players (computer and human) choose to make a deal to share the jackpot, the jackpot is split equally between both players and they both receive half the money. The split jackpot amount (i.e. $50 each) is added to a cumulative total for both players.;11 of 36;If the human player chooses steal the jackpot and the computer player chooses to make a deal to share the jackpot, the human player receives all the money and the computer player who chose to make a deal receives none. The jackpot amount is added to the cumulative total for the human player.;If the computer player chooses steal the jackpot and the human player chooses to make a deal to share the jackpot, the computer player receives all the money and the human player who chose to make a deal receives none. The jackpot amount is added to the cumulative total for the computer player.;If both players (computer and human) choose to steal the jackpot, they both receive nothing. The cumulative total remains unchanged.;Display the results to the screen as seen below;Sample output;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Steal;S: 0 | 0;Too greedy!;You get nothing!;You: 0 | Computer: 0;Jackpot: 100;Steal, Deal or Quit [s|d|q]? s;C: Steal | Deal;S: 100 | 0;You win!;Jackpot!;You: 100 | Computer: 0;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Deal;S: 50 | 50;Draw!;Split pot!;You: 150 | Computer: 50;Jackpot: 100;Steal, Deal or Quit [s|d|q]? d;C: Deal | Steal;S: 0 | 100;You lose!;You get nothing!;You: 150 | Computer: 150

 

Paper#66048 | Written in 18-Jul-2015

Price : $47
SiteLock