Making a checkers board in python [closed]

board = [[0]*8 for i in range(8)] # This makes you 8x8 list
>>>[[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]

def setup(self):
    board = [[0]*self.height for i in range(self.width)]

You only change 8’s with your instance attributes(self.heigth,self.width)

Leave a Comment