diff --git a/Interface/helpers.py b/Interface/helpers.py new file mode 100644 index 0000000..5c5b0f2 --- /dev/null +++ b/Interface/helpers.py @@ -0,0 +1,28 @@ +import pygame + +BLACK = 0, 0, 0 +WHITE = 255, 255, 255 + +def rect(screen, color, position_x, position_y, size_x, size_y): + pygame.draw.rect(screen, color, (position_x,position_y,size_x,size_y)) + +def line(screen, color, x_1, y_1, x_2, y_2): + pygame.draw.line(screen, color, (x_1, y_1), (x_2, y_2)) + +def create_screen(size): + return pygame.display.set_mode(size) + +def draw_board(screen, color, width, height, tiles_x, tiles_y): + tiles_width = width / tiles_x + tiles_height = height / tiles_y + + temp_x = tiles_width + for i in range(tiles_x-1): + line(screen, color, temp_x, 0, temp_x, height) + temp_x += tiles_width + + temp_y = tiles_height + for i in range(tiles_y-1): + line(screen, color, 0, temp_y, width, temp_y) + temp_y += tiles_height + diff --git a/Interface/main.py b/Interface/main.py new file mode 100644 index 0000000..7c030ea --- /dev/null +++ b/Interface/main.py @@ -0,0 +1,23 @@ +import sys, pygame +from helpers import * +pygame.init() + +size = width, height = 1000, 1000 +screen = create_screen(size) + +tiles_x, tiles_y = 10, 10 + + +while True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: sys.exit() + + + screen.fill(BLACK) + # rect(screen, WHITE, 50,50,90,90) + + draw_board(screen, WHITE, width, height, tiles_x, tiles_y) + + + + pygame.display.flip() \ No newline at end of file diff --git a/README.md b/README.md index 8fb250e..c89b860 100644 --- a/README.md +++ b/README.md @@ -1 +1,11 @@ -MACHINE LEARNING 2023 \ No newline at end of file +MACHINE LEARNING 2023 + +python3 -m venv venv + +source venv/bin/activate + +.\venv\Scripts\activate - for windows + +pip install -r requirements.txt + +python Interface/main.py \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..231dd17 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pygame \ No newline at end of file