-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard.py
More file actions
26 lines (26 loc) · 715 Bytes
/
board.py
File metadata and controls
26 lines (26 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import pygame
#initalize the PYGAME
pygame.init()
#Setting screen size & NAME
screen = pygame.display.set_mode((800,800))
pygame.display.set_caption("CHESS")
#Making Board
rows = cols=int(8)
square_size=100
white_colour=(250,250,250)
black_colour=(0,0,0)
#main
def draw_squares(screen):
screen.fill(white_colour)
for row in range(rows):
for colm in range(row % 2, rows, 2):
pygame.draw.rect(screen, black_colour, (colm * square_size, row*square_size, square_size, square_size))
draw_squares(screen)
#loop
i=True
while i:
for event in pygame.event.get():
if event.type==pygame.QUIT:
i=False
pygame.display.update()
pygame.quit()