Refactor maze.c

This commit is contained in:
Arkaprabha Chakraborty
2023-06-03 21:13:36 +05:30
parent a59b36599e
commit 488452de80

13
maze.c
View File

@@ -7,11 +7,13 @@
#include <threads.h> #include <threads.h>
#include <unistd.h> #include <unistd.h>
#define UP 3 #define RIGHT 4
#define LEFT 1 #define LEFT 1
#define DOWN 2 #define DOWN 2
#define RIGHT 4 #define UP 3
typedef struct termios TERMSTATE;
typedef uint8_t DIRECTION;
typedef struct MAPSTRUCT { typedef struct MAPSTRUCT {
size_t x_size; size_t x_size;
size_t y_size; size_t y_size;
@@ -24,10 +26,6 @@ typedef struct MAPSTRUCT {
uint8_t **pntr; uint8_t **pntr;
} MAPSTRUCT; } MAPSTRUCT;
typedef struct termios TERMSTATE;
typedef uint8_t DIRECTION;
TERMSTATE TSTATE; TERMSTATE TSTATE;
MAPSTRUCT *MAP; MAPSTRUCT *MAP;
@@ -184,7 +182,7 @@ void check_win() {
} }
} }
/// Reads keyboard input // Reads keyboard input
void *capture() { void *capture() {
set_term_raw(); // local function: Enable Raw Mode set_term_raw(); // local function: Enable Raw Mode
@@ -259,7 +257,6 @@ int main(int argc, char *argv[]) {
alloc_map(); alloc_map();
load_map(argv[1]); load_map(argv[1]);
// Start Multithreading
pthread_t id_print, id_read; pthread_t id_print, id_read;
pthread_create(&id_print, NULL, print, NULL); pthread_create(&id_print, NULL, print, NULL);