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