Modify nimGameWithGUI.py so that a user can interactively play Nim (NimGame.py). The provided file already works; your assignment is to improve it.
Minimum requirement (worth 3 points out of 5): replace the Label widget that displays as "?replace?" in the GUI (and is named placeholder in the code) with an Entry widget. When the "New Game" button is pressed, the number of initial balls in the new game should be the number in the Entry widget.
Make additional changes of your own choice to improve the game (worth 2 out of 5 points). Possibilities include:
- whenever fewer than three balls remain, inactivate the buttons that would result in illegal moves.
- use the status Label (statusLabel in the code) to provide more feedback to the player. For example, you could remove messages that print to the Python shell, and instead use the status label to display information such as how many balls the computer took, win/lose status ("You win!" or "Computer wins!"), etc.
- Maintain and display a count of how many games have been won/lost by the player and the computer.
- Modify GUI layout, colors, etc.
- improve the graphics via one or more of:
- put numbers in the centers of (or underneath) the balls so it's easier for the player to quickly see how many are left,
- change the drawing code so that the balls appear on the screen in a more pleasing way (perhaps all at once rather than the current one-at-a-time refresh)
- the 1-second delay between balls removed by player and computer seems clunky. Think of a way to make that nicer.
- provide "fancier" win/lose status information using the canvas/graphics area rather than the status label.
- change ball graphics. E.g. make balls look more nicer, or lay them out differently on canvas (perhaps several rows of balls if there are a lot of them)
- How to modify this python code to improve their function to achieve the requirements above? Please explain also.
Changes I picked to improve the game 1. use the status Label (statusLabel in the code) to provide more feedback to the player... View the full answer