You are on page 1of 2

void op(){

char a[MAX_PATH_LEN];
cin>>a;
ofstream fout(a);
OpSeq opseq;
int n;
cin>>n;
fout<<n<<endl;
if(n>game.map_init.num_procs) {cout<<"WARNING!!!!! Reached the limit!!!";return;}
opseq.count=n;
for(int i=0;i<n;i++){
cin>>opseq.procs[i].count;
if(opseq.procs[i].count>game.map_init.op_limit[i]) {cout<<"WARNING!!!!! Reached the
limit!!!";return;}
fout<<opseq.procs[i].count<<" ";
for(int j=0;j<opseq.procs[i].count;j++){
char temp[5];
cin>>temp;
fout<<temp<<" ";
if(strcmp(temp,"TL")==0) opseq.procs[i].ops[j]=TL;
if(strcmp(temp,"TR")==0) opseq.procs[i].ops[j]=TR;
if(strcmp(temp,"MOV")==0) opseq.procs[i].ops[j]=MOV;
if(strcmp(temp,"JMP")==0) opseq.procs[i].ops[j]=JMP;
if(strcmp(temp,"LIT")==0) opseq.procs[i].ops[j]=LIT;
if(strcmp(temp,"CALL")==0) opseq.procs[i].ops[j]=CALL;
//fout<<opseq.procs[i].ops[j]<<" ";
}
fout<<endl;
}
fout.close();
}

void run(){
char path[MAX_PATH_LEN];
cin>>path;
ifstream fin(path);
if(!fin) {cout<<"WARNING:NO SUCH A FILE!!!!!!!!!!!!!!";return;}
status();
//robot_run(path);
return;
}

void exit(){
judge=false;
}

int main(){
game.limit=100;
judge=true;
while(judge){
cin>>Operator;
if(strcmp(Operator,"LOAD")==0) load();
if(strcmp(Operator,"AUTOSAVE")==0) save_set();
if(strcmp(Operator,"LIMIT")==0) limit();
if(strcmp(Operator,"STATUS")==0) status();
if(strcmp(Operator,"OP")==0) op();
if(strcmp(Operator,"RUN")==0) run();
if(strcmp(Operator,"EXIT")==0) exit();
}
}

You might also like