Question: python3.6 need copy code Problem 1 (40 points): CLASSES AND GUIs Part 1: Write a game named ShellGame. A shell game is a game involving
Problem 1 (40 points): CLASSES AND GUIs Part 1: Write a game named ShellGame. A shell game is a "game involving sleight of hand, in which three inverted cups or nutshells are moved about, and contestants must spot which is the one with a pea or other object underneath. You need to design a shell game that supports n shells where the object being searched for is randomly hidden under one of the shells and allows for game to be customized as to what is underneath the shells. The ShellGame has the following methods: init The constructor which has three optional parameters: the number of shells (defaults to 3), the symbol for the winning item (defaults to 'X) and the symbol of the other items under the shells (defaults to an empty string) resetShells: This method resets the game. The "shell" (index) of the winning item is randomized e checkWin: This method takes in as a parameter the index of the item the user believes the winning item is found under. It returns True' if the item is in that index or 'False' if it is not under that shell. If the index goes outside of the bounds of the board, you need to return False getBoard: Return a visual representation of all the 'shells' and what item is under them as a list. Here is sample usage using the default constructor values: >>> s=Shel!Game ( ) >>S.resetShells () >>>s.getBoard () >>>.checkwin (0) False >>>.checkwin (1) False >>>.checkwin (2) True >>>S.resetShells( >>>s.getBoard ) >>S.checkwin (0) False >>s.checkwin (1) True >>>s.checkwin (2) False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
