-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
55 lines (54 loc) · 1.15 KB
/
test.java
File metadata and controls
55 lines (54 loc) · 1.15 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
#include "menu.h"
#include "jeu.h"
#include "tank.h"
#include <curses.h>
int main(int argc, char const *argv[])
{
int i=0, j=0,k, carac, fd;
printf("\033[1;1f");
int tab[HAUTEUR_MAP][LARGEUR_MAP];
fd = open("map.txt", O_RDONLY);
while(1) {
k = read(fd, &carac, 1);
if(k<1) break;
//if(k==EOF) break;
tab[i][j] = carac;
//printf("%c", k);
j++;
if(carac=='\n') {
i++;
j=0;
}
}
for(i=1;i<HAUTEUR_MAP;i++) {
for(j=1;j<LARGEUR_MAP;j++) {
if(tab[i][j]=='A') {
//printf("\033[1;31m");
//printf("📺");
printf("A");
//printf("\033[0m");
} else if(tab[i][j] == 'B') {
//printf("\033[1m\033[37m");
//printf("📺");
printf("B");
//printf("\033[0m");
} else if(tab[i][j]=='D'){
//printf("\033[01;33m");
//printf("🐬");
printf("D");
//printf("\033[0m");
} else {
printf("%c", tab[i][j]);
}
}
}
return 0;
}