# How do I extend the chessboard?

Hi i want to extend the chessboard from the chessboard tutorial so that instead of being 64x64 is 512x512

i thought that i could just change these lines of code here:

``````    self.squares = [None for i in range(64)]
self.pieces = [None for i in range(64)]
for i in range(64):``````

and change the numbers to 512
but when i run to see the results the chessboard has been extended upwards (so now it’s no longer square but it’s a rectangle)
how do i make it into a square? i can’t see anything that limits the board so it only grows upwards…

Hello Chirone.
I thinks you have to modify SquarePos() method.
and SquareColor() method.

Assume we want 12 x 12 chessboard you must change codes into this line below

``````def SquarePos(i):
return Point3((i%12) - 3.5, int(i/12) - 3.5, 0)``````
``````def SquareColor(i):
if (i + ((i/12)%2))%2: return BLACK
else: return WHITE``````
``````self.squares = [None for i in range(144)]
self.pieces = [None for i in range(144)]
for i in range(144):``````

Hope these will help.

ah i see! it works! i can’t believe i missed that!

thanks MaYuMi!