Question: write code under functions playround and __str__ and without tkinter and in python def __init__(self, N): Constructor pre: N is an integer, denotes the number
write code under functions playround and __str__ and without tkinter and in python def __init__(self, N): """Constructor pre: N is an integer, denotes the number of piles, s.t. 1 < N < 50 post: self.size is the number of piles""" if N < 1 or N>50: raise ValueError self.size = N def newGame(self): """ Creates a new game post: creates an instance of Solitaire game with N empty places""" self.deck = Deck() # creating a deck of cards self.deck.shuffle() # shuffling them in place self.places = [self.deck.deal() for i in range(self.size)] # creating self.size(N) piles, with one card in each def playRound(self): """ a round of a game pre: all piles are not empty post: piles with same rank get new cards on top of them, returns True if successful, and False if no cards were placed into piles""" #find two piles (in self.places) with the cards with the same rank, # say at position i and j #deal new cards from the deck into piles i and j #return True #if piles with cards of the same rank were found, then return False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
