diff --git a/src/main/c/Minesweeper/minesweeper_start.c b/src/main/c/Minesweeper/minesweeper_start.c index 2737d4d..3f46eec 100644 --- a/src/main/c/Minesweeper/minesweeper_start.c +++ b/src/main/c/Minesweeper/minesweeper_start.c @@ -1,5 +1,7 @@ #include +#include #include +#include "minesweeper_start.h" #pragma region defines #define BLOCK 219 #define FLAG '?' @@ -17,6 +19,8 @@ void main_menu_minesweeper(); void game_minesweeper(); void options_minesweeper(); +Minesweeper_Board initialize_minesweeper(); +void draw_minesweeper(); #pragma endregion #pragma region Global @@ -26,7 +30,7 @@ int num_bombs = MIDDLE * MIDDLE / NORMAL; #pragma endregion //Global -int minesweeper_start(){ +void minesweeper_start(){ system("clear"); main_menu_minesweeper(); } @@ -65,7 +69,8 @@ void main_menu_minesweeper(){ } void game_minesweeper(){ - + Minesweeper_Board board = initialize_minesweeper(); + draw_minesweeper(); } void options_minesweeper(){ @@ -119,4 +124,20 @@ void options_minesweeper(){ break; } } +} + +Minesweeper_Board initialize_minesweeper(){ + Minesweeper_Board board; + board.width = width; + board.height = height; + char *tiles = (char*) malloc(width * height * sizeof(char)); + for(int i = 0; i < width * height; i++){tiles[i] = FLAG;} + board.tiles = tiles; + board.num_bombs = num_bombs; + + return board; +} + +void draw_minesweeper(){ + } \ No newline at end of file diff --git a/src/main/c/Minesweeper/minesweeper_start.h b/src/main/c/Minesweeper/minesweeper_start.h index 1bb6a7d..bf0f21a 100644 --- a/src/main/c/Minesweeper/minesweeper_start.h +++ b/src/main/c/Minesweeper/minesweeper_start.h @@ -6,7 +6,7 @@ typedef struct Minesweeper_Board{ unsigned int height; char *tiles; int num_bombs; - unsigned int bombs[]; + int *bombs; }Minesweeper_Board; diff --git a/src/main/c/Snake/snake_start.c b/src/main/c/Snake/snake_start.c index f3ce799..26c83c4 100644 --- a/src/main/c/Snake/snake_start.c +++ b/src/main/c/Snake/snake_start.c @@ -19,7 +19,7 @@ void options_snake(); Snake initialize_snake(); void get_next_move(double limit, Snake *snake, bool *running); void move_snake(Snake *snake); -void draw(Snake *snake, unsigned char fruit); +void draw_snake(Snake *snake, unsigned char fruit); int part_of_snake(Snake *snake, unsigned char tile); bool check_if_dead(Snake *snake); unsigned char spawn_fruit(Snake *snake); @@ -76,7 +76,7 @@ void game_snake(){ while (running){ system("clear"); - draw(&snake, fruit); + draw_snake(&snake, fruit); if(check_if_dead(&snake)){break;} t = clock() - t; get_next_move(TIME_TURN - (double)t / CLOCKS_PER_SEC, &snake, &running); @@ -141,7 +141,7 @@ void move_snake(Snake *snake){ snake->segments[0] += snake->direction; } -void draw(Snake *snake, unsigned char fruit){ +void draw_snake(Snake *snake, unsigned char fruit){ printf("Score:%d Speed:%f\n", snake->length - START_LENGTH, TIME_TURN); printf("+"); for(int i = 0; i < WIDTH; i++){printf("-");}