updated geroge_interpertereterteter.c
This commit is contained in:
parent
ed495aa83b
commit
e3d935c5b1
@ -6,30 +6,56 @@ char s_toin[260];
|
|||||||
char toin[260];
|
char toin[260];
|
||||||
FILE *filein;
|
FILE *filein;
|
||||||
int unin[1024];
|
int unin[1024];
|
||||||
int in[1024];
|
int in[1024];
|
||||||
|
char verbs[10][9] = {
|
||||||
|
{"forward"}, //1
|
||||||
|
{"backward"},
|
||||||
|
{"left"},
|
||||||
|
{"right"},
|
||||||
|
{"north"},
|
||||||
|
{"east"},
|
||||||
|
{"south"},
|
||||||
|
{"west"}, //8
|
||||||
|
{"turn"},
|
||||||
|
{"comment"}
|
||||||
|
};
|
||||||
|
//char nouns[][];
|
||||||
|
|
||||||
void openfile() {
|
void openfile() {
|
||||||
printf("file to open...\n"); //open the file
|
printf("file to open...\n"); //open the file
|
||||||
scanf("%260s", s_toin);
|
scanf("%260s", s_toin);
|
||||||
printf("opening %s...\n",&toin);
|
printf("opening %s...\n",s_toin);
|
||||||
snprintf(toin, sizeof(toin), "%s", s_toin); //put filename in string that fopen likes
|
snprintf(toin, sizeof(toin), "%s", s_toin); //put filename in string that fopen likes
|
||||||
if (access(toin, F_OK) == 0) { //does file exsist?
|
if (access(toin, F_OK) == 0) { //does file exsist?
|
||||||
filein = fopen(toin, "r"); //file exsists, open it
|
filein = fopen(toin, "r"); //file exsists, open it
|
||||||
} else {
|
} else {
|
||||||
printf("error opening %s, press any key to exit...", &toin); //file doesnt exsist, exit
|
printf("error opening %s, press enter to exit...", &toin); //file doesnt exsist, exit
|
||||||
getch();
|
scanf("", NULL);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(filein,"%s",*unin);
|
for (int i = 0; i < 1024; i++) {
|
||||||
printf("fprintf\n");//debug
|
unin[i] = fgetc(filein);
|
||||||
for (int j = 0; j < 1024; j++) {
|
}
|
||||||
printf()//maybe just printf a string
|
for (int i = 0; i < 1024; i++) {
|
||||||
|
if (unin[i] != -1) {
|
||||||
|
printf("%c",unin[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void interpret() {
|
||||||
|
for (int i = 0; i < 1024; i++) {
|
||||||
|
for (int j = 0; j < 10; j++) { //verbs[this][not this]
|
||||||
|
for (int k = 0; k < 10; k++) { //verbs[not this][this]
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
openfile();
|
openfile();
|
||||||
|
interpret();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -1,3 +1,5 @@
|
|||||||
test
|
foward
|
||||||
balls
|
backward
|
||||||
george
|
left
|
||||||
|
right
|
||||||
|
balls
|
||||||
Loading…
Reference in New Issue
Block a user