Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Modify nimGameWithGUI.py so that a user can interactively play Nim (the game from HW 6, Q2). The provided file already works. Load it into Python and...

Modify nimGameWithGUI.py so that a user can interactively play Nim (the game from HW 6, Q2). The provided file already works. Load it into Python and execute runNim([1,2,3]) to see what it does. Your assignment is to improve it.

Minimum requirements (worth 3 out of 4 points):

  • add a button to start a new game. As part of this 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 initial heaps in the new game should ceated based on the information in the Entry widget.
  • use the status Label (statusLabel in the code) to provide feedback to the player in the GUI rather than in the Python shell. This includes information such as how many balls the computer or player took from which heap, win/lose status ("You win!" or "Computer wins!"), etc.
  • add a label or label that shows how many games the player has won and how many the computer has won since starting the program.

The basic GUI isn't very nice. Make one or more additional changes of your own choice to improve the game (worth 1 out of 4 points). Possibilities include:

  • modify GUI layout, change colors, etc.
  • change the drawing code so that the balls appear and disappear from the screen in a more pleasing way or interesting way.
  • 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/heap graphics. E.g. make heaps/balls look more nicer/different, or lay them out differently on canvas.
  • something else you think of

The code they gave us is:

Note: if you want to use
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question