#include #include #include "robot.h" int main(int argc, char *argv[]) {int mode, port,yesorno,view; char name[15], lab[16], ip[20]; printf("dwse thn ip tou server\n"); scanf("%s",&ip); printf("dwse to port tou robot\n"); scanf("%d",&port); labConnect(ip,port); printf("dwse to onoma tou labyrinthou sth morfh labyrinthNUM.lab opou NUM oi 5,6,10,12\n"); scanf("%s",&lab); labLoadLabyrinth(lab); printf("dwse to onoma sou\n"); scanf("%s",&name); labInsertRobot(name); printf("Epilogi leitourgias:\n 0 gia automati\n 1 gia xeirokiniti\n"); scanf("%d",&mode); labSetMode(mode); if (mode==0) { printf("elegxos robot:\n 1)elegxeis esu to robot\n 2)an oxi dwse 0\n"); scanf("%d",&yesorno); if (yesorno==0) { while (robotExitFound()==0) { view=robotGetView(); if(view=1000) { robotGoAhead(); view =robotGetView(); if(view!=1000) { robotTurnLeft(); view=robotGetView(); if(view!=1000) robotTurnRight(); } else { robotGoAhead(); }robotStep(8); } } } else { printf("epekshghsh plhktrwn : w:mposta, a:aristera, d:deksia, s:stop, z:destroy, x:disconnect, h:GoHome\n"); while(robotExitFound()==0) { view=getch(); switch(view) { case 'w': robotGoAhead(); break; case 'a' : robotTurnLeft(); break; case 'd' : robotTurnRight(); break; case 's' : robotStop(); break; case 'z' : labDestroyRobot(); break; case 'x' : labDisconnect(); break; case 'h' : robotGoHome(); break; } } } } system("PAUSE"); return 0; }