182k views
0 votes
Please modify the Rock, Paper, Scissors python program to count your wins losses and ties and store this in a file on the hard drive. When the program starts, it will need to ask for a player's name, check if a file already exists, create a player file if none exists and display the currant count of wins, losses and ties. After play has finished, display total current counts and update current counts to the file. Add game play results to those counts in an on-going basis. The tally will be player specific. Take your player file data and import it into Excel (think XML) and bar or line graph daily, weekly and monthly statistics. You can use Excel or Python to do this actually. Then publish these stats (graphs) to a class webpage for all to see. (multi-player results on one webpage)

*ALSO PLEASE MAKE SURE THAT THE CODE WORKS ON IDLE. I HAVE TRIED OTHER RESPONSES . However , there's an issue in line" 8" --> line 8 shows an error on the IDLE

User Cristofor
by
7.7k points

1 Answer

3 votes

Final answer:

The Rock, Paper, Scissors Python program can be modified by implementing a user input for naming, checking for pre-existing files, tracking scores, and updating them after playing. The scores are saved and can be graphed using Excel, with the results being publishable on a class webpage.

Step-by-step explanation:

Modifying the Rock, Paper, Scissors Python Program-

To modify the Rock, Paper, Scissors Python program to count wins, losses, and ties and store them in a file, we need to write a program that accomplishes several tasks. First, the program must prompt the player for their name and check if a player file already exists. If it doesn't, the program should create a new one. Then, the program must track and update the player's scores, save them to the hard drive, and allow for their importation into Excel for graphing purposes. Publishing to a webpage entails additional steps and may require knowledge of web development or integration with a service that can display the graphs.

Extract of the Python Program-

The main structure of the Python script consists of:

  1. Asking for player's name and handling file operations for reading or creating player score file.
  2. Running the game while keeping track of the scores using a loop.
  3. Updating the results in the file after the game session ends.
  4. Exporting the game statistics to an XML file that can be used in Excel.
  5. Graphing the results using Excel's capabilities or Python's plotting libraries.
  6. Publishing the graphs to a class webpage, which can be handled by an additional script or manual upload.

CODE to keep track of the scoring will be managed by a dictionary with keys 'wins', 'losses', and 'ties', and their corresponding counts as values. Each game round's outcome will update this dictionary.

User Mr Anderson
by
7.9k points