The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 314 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Please use Python 3.6 to answer the question in HW1.docx
Group Homework 1: Chess Game File
In chess, we can record the moves that are made during a game using a simple notation where for each move we note the piece that moved and where it move to on the board. One turn consists of both Player 1 (white) and Player 2 (black) making a move that is recorded on the same line. We can abbreviate pieces to: Pawn = P, Rook = R, Knight = N, Bishop = B, Queen = Q, and King = K
Create a Python file that can read a text file with a list of chess moves, display those moves, ask the user to enter in move moves to add to the file, then save out the new game.
The final output should look like this (without the typo ‘laod’, which should be ‘load’):
Â
To achieve this, complete the following:
Step 1 (5 points): Ask the user what file they would like to open and read in its contents. game_moves.txt is a sample file that may be used for this. Your code should work with any file that follows the same formatting as game_moves.txt
Step 2 (15 points): Use the format method to display the contents of the file formatted the same way as in the example below:
Â
Step 3 (10 points): Repeatedly ask the user to enter moves for Player 1 and Player 2. Keep track of their responses. After each pair of moves, ask the user if they would like to continue:
               Step 4 (20 points): When the user says they don’t want another turn, write out the entire game (both the initial moves and the user enter moves) to a file, formatted in such a way that the file can be read back in by this program:
Â
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly