94.5k views
4 votes
Write a method __repr__(self) that returns a string representing an AIPlayer object. This method will override/replace the __repr__ method that is inherited from Player. In addition to indicating which checker the AIPlayer object is using, the returned string should also indicate the player’s tiebreaking strategy and lookahead. For example:

1 Answer

3 votes

Answer:

def __repr__(self):

s = '' "

for row in range(self.height):

s += '|'

for column in range(self.width):

s += self.slots[row][column] + '|' + '\\' + (2*self.width +1)*'-' + '\\' + ' '+str(column%10)

return s

Step-by-step explanation:

The __repr__(self) method in python's object-oriented programming is a magic method used to print an output that represent the object instance of a class.

User Gimhani
by
4.9k points