From d1a4ae17a1d8e7c5ca120e06ebd7a31f15f8f6a6 Mon Sep 17 00:00:00 2001 From: milanjaeckel Date: Sun, 10 May 2026 10:11:15 +0200 Subject: [PATCH] rendered full chessboard (hardcoded) --- main.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 2f8e5a1..dd1fdfc 100644 --- a/main.py +++ b/main.py @@ -5,7 +5,12 @@ pg.init() screen = pg.display.set_mode((800, 800)) #window (size) clock = pg.time.Clock() running = True -color = (0, 0, 0) #rectangle color + +color = (255, 255, 255) #rectangle color +positionX = 0 #recatangle position x +positionY = 0 #recatangle position y +size = 100, 100 #rectangle size + while running: #open window @@ -14,10 +19,49 @@ while running: #open window running = False #render frame - screen.fill("white") + screen.fill("black") #chess game pg.draw.rect(screen, color, pg.Rect(0, 0, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(200, 0, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(400, 0, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(600, 0, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(100, 100, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(300, 100, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(500, 100, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(700, 100, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(0, 200, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(200, 200, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(400, 200, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(600, 200, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(100, 300, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(300, 300, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(500, 300, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(700, 300, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(0, 400, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(200, 400, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(400, 400, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(600, 400, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(100, 500, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(300, 500, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(500, 500, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(700, 500, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(0, 600, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(200, 600, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(400, 600, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(600, 600, 100, 100)) + + pg.draw.rect(screen, color, pg.Rect(100, 700, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(300, 700, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(500, 700, 100, 100)) + pg.draw.rect(screen, color, pg.Rect(700, 700, 100, 100)) + #flip display to put game on screen