From c3865b164d9defa4a3517efa1462beb07ad2f939 Mon Sep 17 00:00:00 2001 From: Julia Selig Date: Wed, 31 Jan 2024 13:09:11 +0000 Subject: [PATCH] Erstellen Spielfeld --- src/main/c/Pong/game.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main/c/Pong/game.c b/src/main/c/Pong/game.c index 8b13789..b2969e0 100644 --- a/src/main/c/Pong/game.c +++ b/src/main/c/Pong/game.c @@ -1 +1,25 @@ +#include +#define WIDTH 40 //Breite Spielfeld +#define HEIGHT 20 //Höhe Spielfeld + +void drawField() { + for (int i = 0; i <= HEIGHT; i++){ + for (int j = 0; j <= WIDTH; j++){ + if (i == 0 || i == HEIGHT){ + printf("-"); + } else if ("i == 0 || j == WIDTH") { + printf("|"); + } else { + printf(" "); + } + } + printf("\n"); + } +} + +int main(){ + drawField(); + + return 0; +}