|
@ -1,6 +1,3 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <stdbool.h> |
|
|
#include <stdbool.h> |
|
@ -59,7 +56,21 @@ void availableLevelsFunction(int difficulty) { |
|
|
void selectLevel(int grid[SIZE][SIZE]) { |
|
|
void selectLevel(int grid[SIZE][SIZE]) { |
|
|
int level = 0; |
|
|
int level = 0; |
|
|
printf("\nSelect a level:\n"); |
|
|
printf("\nSelect a level:\n"); |
|
|
|
|
|
|
|
|
|
|
|
while (true){ |
|
|
|
|
|
char level_select[10]; |
|
|
|
|
|
scanf("%s", level_select); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
level = level_select[0] - '0'; // Convert the first character to an integer |
|
|
|
|
|
|
|
|
|
|
|
if ((level >= 1 && level <= 3) && level_select[1] == '\0') { |
|
|
|
|
|
printf("Input is correct"); |
|
|
|
|
|
break; |
|
|
|
|
|
} else { |
|
|
|
|
|
printf("Invalid input. Please enter a number between 1 and 3.\n"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|