-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualisation.c
30 lines (26 loc) · 896 Bytes
/
visualisation.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <string.h>
void create_board(char board[3][3]){
printf(" 1 2 3 ", board[0][0], board[0][1], board[0][2]);
printf("\n1 %c | %c | %c ", board[0][0], board[0][1], board[0][2]);
printf("\n ---|---|---");
printf("\n2 %c | %c | %c ", board[1][0], board[1][1], board[1][2]);
printf("\n ---|---|---");
printf("\n3 %c | %c | %c \n", board[2][0], board[2][1], board[2][2]);
}
void create_buttons(short value, char writings[]){
char toWrite[256] = "";
int j = 0;
for(int i = 0; i < value; i++){
while (writings[j] != ' ' && writings[j] != '\0') {
strncat(toWrite, &writings[j], 1);
j++;
}
printf("|----------------------|\n");
printf("|%s\n", toWrite);
printf("|----------------------|\n\n");
toWrite[0] ='\0';
j++;
}
printf("Option: ");
}