Skip to content

Commit 65216c3

Browse files
authored
Zhed.py
1 parent d06f742 commit 65216c3

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

Zhed/Zhed.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import pygame
2+
import sys
3+
4+
# Initialize Pygame
5+
pygame.init()
6+
7+
# Constants
8+
WIDTH, HEIGHT = 400, 400
9+
GRID_SIZE = 5
10+
CELL_SIZE = WIDTH // GRID_SIZE
11+
12+
# Colors
13+
WHITE = (255, 255, 255)
14+
BLACK = (0, 0, 0)
15+
RED = (255, 0, 0)
16+
17+
# Create the screen
18+
screen = pygame.display.set_mode((WIDTH, HEIGHT))
19+
pygame.display.set_caption("Zhed")
20+
21+
# Main loop
22+
def main():
23+
running = True
24+
25+
while running:
26+
for event in pygame.event.get():
27+
if event.type == pygame.QUIT:
28+
running = False
29+
30+
screen.fill(WHITE)
31+
draw_grid()
32+
33+
pygame.display.flip()
34+
35+
pygame.quit()
36+
sys.exit()
37+
38+
# Draw the grid
39+
def draw_grid():
40+
for x in range(0, WIDTH, CELL_SIZE):
41+
pygame.draw.line(screen, BLACK, (x, 0), (x, HEIGHT))
42+
for y in range(0, HEIGHT, CELL_SIZE):
43+
pygame.draw.line(screen, BLACK, (0, y), (WIDTH, y))
44+
45+
# Start the game
46+
if __name__ == "__main__":
47+
main()

0 commit comments

Comments
 (0)