Advertisement
Guest User

Untitled

a guest
Oct 10th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Robots 15.79 KB | None | 0 0
  1.  
  2. #pragma config(Sensor, S2,     gyroSensor,     sensorEV3_Gyro, modeEV3Gyro_RateAndAngle)
  3. #pragma config(Sensor, S3,     Colourright,         sensorEV3_Color, modeEV3Color_Reflected)
  4. #pragma config(Sensor, S1,     Colourleft,         sensorEV3_Color, modeEV3Color_Reflected)
  5. #pragma config(Sensor, S4,     sonarSensor,    sensorEV3_Ultrasonic)
  6. #pragma config(Motor,  motorA,          armMotor,      tmotorEV3_Medium, PIDControl, driveLeft, encoder)
  7. #pragma config(Motor,  motorB,          leftMotor,     tmotorEV3_Large, PIDControl, driveLeft, encoder)
  8. #pragma config(Motor,  motorC,          rightMotor,    tmotorEV3_Large, PIDControl, driveRight, encoder)
  9. //*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
  10.  
  11. int check_map[9][9],map_up[9][9],map_right[9][9],map_left[9][9],map_down[9][9];
  12. int available_block=0,n=9,short_map[9][9],position_temp[90][2],chk_finish = 0;
  13. int x=23;
  14.  
  15. void checkSoundFile(const char *pFileName)
  16. {
  17.     bool bExists;
  18.  
  19.     bExists = bEv3FileExists(pFileName);
  20.     while (!bSoundQueueAvailable)
  21.     {}
  22.     playSoundFile(pFileName);
  23.     return;
  24. }
  25.  
  26.  
  27. void checklineback(){
  28.     clearTimer(T1);
  29.     checkSoundFile("Backwards");
  30.     wait1Msec(500);
  31.     checkSoundFile("Backing alert");
  32.     while (true)
  33.     {
  34.         // Write the amount of reflected light to the screen
  35.         // This is a value between 0 and 100, where 0 means no reflected
  36.         // light and 100 means all light is being reflected
  37.         displayTextLine(14,"   checkLineBack = %d",time1[T1]);
  38.         if(time1[T1] < 8000){
  39.             if(SensorValue[S1]<x&&SensorValue[S3]>x){
  40.                 motor[motorB]=-2;
  41.                 motor[motorC]=0;
  42.             }else if(SensorValue[S1]>x&&SensorValue[S3]<x){
  43.                 motor[motorB]=0;
  44.                 motor[motorC]=-2;
  45.             }else if(SensorValue[S1]<x&&SensorValue[S3]<x){
  46.                 motor[motorB]=-15;
  47.                 motor[motorC]=-15;
  48.             }else if((SensorValue[S1]>x&&SensorValue[S3]>x)||(((SensorValue[S1]-SensorValue[S3])>-2)&&((SensorValue[S1]-SensorValue[S3])<2))){
  49.                 break;
  50.             }
  51.         }
  52.         else break;
  53.         // Wait 20 ms to get 50 readings per second
  54.         sleep(20);
  55.     }
  56.     motor[motorB] = 0;
  57.     motor[motorC] = 0;
  58.     wait1Msec(500);
  59. }
  60.  
  61. void walkbackfromline(){
  62.     clearTimer(T1);
  63.  
  64.     while(true){
  65.         displayTextLine(14,"walkBackFromLine = %d",time1[T1]);
  66.         if(time1[T1] < 15000){
  67.             if(SensorValue[S1]>x-3&&SensorValue[S3]>x-3){
  68.                 motor[motorB]=-1;
  69.                 motor[motorC]=-1;
  70.             }else if(SensorValue[S1]<x-6&&SensorValue[S3]>x-6){
  71.                 motor[motorB]=0;
  72.                 motor[motorC]=-1;
  73.             }else if(SensorValue[S1]>x-6&&SensorValue[S3]<x-6){
  74.                 motor[motorB]=-1;
  75.                 motor[motorC]=0;
  76.             }else if(SensorValue[S1]<x-6&&SensorValue[S3]<x-6){
  77.                 break;
  78.             }
  79.         }
  80.         else break;
  81.         sleep(20);
  82.     }
  83.     motor[motorB] = 0;
  84.     motor[motorC] = 0;
  85.     wait1Msec(500);
  86.  
  87.     checkSoundFile("Backwards");
  88.     wait1Msec(500);
  89.     checkSoundFile("Backing alert");
  90.    
  91.     moveMotorTarget(motorB,130,-30);
  92.     moveMotorTarget(motorC,130,-30);
  93.     wait1Msec(500);
  94. }
  95.  
  96. void checkline(){
  97.     clearTimer(T1);
  98.     checkSoundFile("Forward");
  99.     wait1Msec(500);
  100.     checkSoundFile("Flashing");
  101.     while (true)
  102.     {
  103.         // Write the amount of reflected light to the screen
  104.         // This is a value between 0 and 100, where 0 means no reflected
  105.         // light and 100 means all light is being reflected
  106.         displayTextLine(14,"checkLine = %d",time1[T1]);
  107.  
  108.         if(time1[T1] < 5000){
  109.             if(SensorValue[S1]<x&&SensorValue[S3]>x){
  110.                 motor[motorB]=2;
  111.                 motor[motorC]=-2;
  112.             }else if(SensorValue[S1]>x&&SensorValue[S3]<x){
  113.                 motor[motorB]=-2;
  114.                 motor[motorC]=2;
  115.             }else if(SensorValue[S1]<x&&SensorValue[S3]<x){
  116.                 motor[motorB]=15;
  117.                 motor[motorC]=15;
  118.             }else if((SensorValue[S1]>x&&SensorValue[S3]>x)||(((SensorValue[S1]-SensorValue[S3])>-2)&&((SensorValue[S1]-SensorValue[S3])<2))){
  119.                 break;
  120.             }
  121.         }
  122.         else break;
  123.         // Wait 20 ms to get 50 readings per second
  124.         sleep(20);
  125.     }
  126.     motor[motorB]=0;
  127.     motor[motorC]=0;
  128.     wait1Msec(500);
  129. }
  130.  
  131. void walkfromline(){
  132.     clearTimer(T1);
  133.     while(true){
  134.         displayTextLine(14,"walkFromLine = %d",time1[T1]);
  135.         if(time1[T1] < 5000){
  136.             if(SensorValue[S1]>x&&SensorValue[S3]>x){
  137.                 motor[motorB]=2;
  138.                 motor[motorC]=2;
  139.             }else if(SensorValue[S1]<x-6&&SensorValue[S3]>x-6){
  140.                 motor[motorB]=0;
  141.                 motor[motorC]=2;
  142.             }else if(SensorValue[S1]>x-6&&SensorValue[S3]<x-6){
  143.                 motor[motorB]=2;
  144.                 motor[motorC]=0;
  145.             }else if(SensorValue[S1]<x-6&&SensorValue[S3]<x-6){
  146.                 break;
  147.             }
  148.         }
  149.         else break;
  150.         sleep(20);
  151.     }
  152.  
  153.     motor[motorB] = 0;
  154.     motor[motorC] = 0;
  155.     wait1Msec(500);
  156.     checkSoundFile("Forward");
  157.     wait1Msec(500);
  158.     checkSoundFile("Flashing");
  159.     moveMotorTarget(motorB,400,30);
  160.     moveMotorTarget(motorC,400,30);
  161.     wait1Msec(500);
  162. }
  163.  
  164. int check_right(){
  165.     resetMotorEncoder(motorA);
  166.     while(getMotorEncoder(motorA) < 110){
  167.         setMotorSpeed(motorA,10);
  168.     }
  169.     setMotorSpeed(motorA,0);
  170.     int a = getUSDistance(S4);
  171.     return a;
  172. }
  173.  
  174. int check_left(){
  175.     resetMotorEncoder(motorA);
  176.     while(getMotorEncoder(motorA) > -110){
  177.         setMotorSpeed(motorA,-10);
  178.     }
  179.     setMotorSpeed(motorA,0);
  180.     int b = getUSDistance(S4);
  181.     return b;
  182. }
  183.  
  184. int check_positionY(int direction,int x,int y){
  185.     if(direction == 1){
  186.         return y;
  187.     }
  188.     else if(direction == 2){
  189.         return y+1;
  190.     }
  191.     else if(direction == 3){
  192.         return y-1;
  193.     }
  194.     else if(direction == 4){
  195.         return y;
  196.     }
  197.     return 0;
  198. }
  199.  
  200. int check_positionX(int direction,int x,int y){
  201.     if(direction == 1){
  202.         return x-1;
  203.     }
  204.     else if(direction == 2){
  205.         return x;
  206.     }
  207.     else if(direction == 3){
  208.         return x;
  209.     }
  210.     else if(direction == 4){
  211.         return x+1;
  212.     }
  213.     return 0;
  214. }
  215.  
  216. void forward(){
  217.     int a = check_right();
  218.     int b = check_left();
  219.     b = check_left();
  220.     int c = check_right();
  221.  
  222.     if(b < 10){
  223.         moveMotorTarget(motorB, 50, 15);
  224.         moveMotorTarget(motorC, 50, 0);
  225.     }
  226.     if(a < 10){
  227.         moveMotorTarget(motorC, 50, 15);
  228.         moveMotorTarget(motorB, 50, 0);
  229.     }
  230.     if(a >= 14 && a < 25){
  231.         moveMotorTarget(motorB, 50, 15);
  232.         moveMotorTarget(motorC, 50, 0);
  233.     }
  234.     if(b >= 14 && b < 25){
  235.         moveMotorTarget(motorC, 50, 15);
  236.         moveMotorTarget(motorB, 50, 0);
  237.     }
  238.     wait1Msec(500);
  239.  
  240.     checkline();
  241.     walkfromline();
  242. }
  243.  
  244. void backward(){
  245.     int a = check_right();
  246.     int b = check_left();
  247.     b = check_left();
  248.     int c = check_right();
  249.  
  250.     if(b < 10){
  251.         moveMotorTarget(motorB, 30, -15);
  252.         moveMotorTarget(motorC, 30, 0);
  253.     }
  254.     if(a < 10){
  255.         moveMotorTarget(motorC, 30, -15);
  256.         moveMotorTarget(motorB, 30, 0);
  257.     }
  258.     if(a >= 14 && a < 25){
  259.         moveMotorTarget(motorB, 30, -15);
  260.         moveMotorTarget(motorC, 30, 0);
  261.     }
  262.     if(b >= 14 && b < 25){
  263.         moveMotorTarget(motorC, 30, -15);
  264.         moveMotorTarget(motorB, 30, 0);
  265.     }
  266.     wait1Msec(500);
  267.  
  268.     checklineback();
  269.     walkbackfromline();
  270. }
  271.  
  272. void turn_right(){
  273.     resetMotorEncoder(motorB);
  274.     resetMotorEncoder(motorC);
  275.     checkSoundFile("Turn");
  276.     wait1Msec(200);
  277.     checkSoundFile("Right");
  278.     wait1Msec(500);
  279.     checkSoundFile("Speed up");
  280.  
  281.     while(getMotorEncoder(motorB) < 200)                   {
  282.         setMotorSpeed(motorB,30);
  283.         setMotorSpeed(motorC,-30);
  284.     }
  285.  
  286.     setMotorSpeed(motorB,0);
  287.     setMotorSpeed(motorC,0);
  288.     wait1Msec(1000);
  289. }
  290.  
  291. void turn_left(){
  292.     resetMotorEncoder(motorB);
  293.     resetMotorEncoder(motorC);
  294.     checkSoundFile("Turn");
  295.     wait1Msec(200);
  296.     checkSoundFile("Left");
  297.     wait1Msec(500);
  298.     checkSoundFile("Speed up");
  299.  
  300.     while(getMotorEncoder(motorC) < 200){
  301.         setMotorSpeed(motorB,-30);
  302.         setMotorSpeed(motorC,30);
  303.     }
  304.  
  305.     setMotorSpeed(motorB,0);
  306.     setMotorSpeed(motorC,0);
  307.     wait1Msec(1000);
  308. }
  309.  
  310. void check_direction(int init_direction,int direction){
  311.     if(direction == 1){
  312.         if(init_direction == 2){
  313.             turn_right();
  314.         }else if(init_direction == 3){
  315.             turn_left();
  316.         }else if(init_direction == 4){
  317.             turn_right();
  318.             turn_right();
  319.         }
  320.     }
  321.     else if(direction == 2){
  322.         if(init_direction == 1){
  323.             turn_left();
  324.         }else if(init_direction == 3){
  325.             turn_right();
  326.             turn_right();
  327.  
  328.         }else if(init_direction == 4){
  329.             turn_right();
  330.         }
  331.     }
  332.     else if(direction == 4){
  333.         if(init_direction == 1){
  334.             turn_right();
  335.             turn_right();
  336.  
  337.         }else if(init_direction == 2){
  338.             turn_left();
  339.  
  340.         }else if(init_direction == 3){
  341.             turn_right();
  342.         }
  343.     }
  344.     else if(direction == 3){
  345.         if(init_direction == 1){
  346.             turn_right();
  347.         }else if(init_direction == 2){
  348.             turn_right();
  349.             turn_right();
  350.  
  351.         }else if(init_direction == 4){
  352.             turn_left();
  353.         }
  354.     }
  355. }
  356.  
  357. void assign_map(int nxt_position,int direction,int x,int y){
  358.     if(direction == 1){
  359.         if(nxt_position == 1){
  360.             map_up[x][y] = 1;
  361.             map_down[x-1][y] = 1;
  362.         }else if(nxt_position == 2){
  363.             map_right[x][y] = 1;
  364.             map_left[x][y+1] = 1;
  365.         }else if(nxt_position == 3){
  366.             map_left[x][y] = 1;
  367.             map_right[x][y-1] = 1;
  368.         }
  369.     }else if(direction == 2){
  370.         if(nxt_position == 1){
  371.             map_right[x][y] = 1;
  372.             map_left[x][y+1] = 1;
  373.         }else if(nxt_position == 2){
  374.             map_down[x][y] = 1;
  375.             map_up[x+1][y] = 1;
  376.         }else if(nxt_position == 3){
  377.             map_up[x][y] = 1;
  378.             map_down[x-1][y] = 1;
  379.         }
  380.     }else if(direction == 3){
  381.         if(nxt_position == 1){
  382.             map_left[x][y] = 1;
  383.             map_right[x][y-1] = 1;
  384.         }else if(nxt_position == 2){
  385.             map_up[x][y] = 1;
  386.             map_down[x-1][y] = 1;
  387.         }else if(nxt_position == 3){
  388.             map_down[x][y] = 1;
  389.             map_up[x+1][y] = 1;
  390.         }
  391.     }else if(direction == 4){
  392.         if(nxt_position == 1){
  393.             map_down[x][y] = 1;
  394.             map_up[x+1][y] = 1;
  395.         }else if(nxt_position == 2){
  396.             map_left[x][y] = 1;
  397.             map_right[x][y-1] = 1;
  398.         }else if(nxt_position == 3){
  399.             map_right[x][y] = 1;
  400.             map_left[x][y+1] = 1;
  401.         }
  402.     }
  403. }
  404.  
  405. void travel(int x,int y,int direction){     //direction 1=up 2=right 3=left 4=down
  406.     int first_direction,next_positionX,next_positionY,degree;
  407.     int chk=0;
  408.    
  409.     if(check_map[x][y] == 1) {return;}
  410.  
  411.     check_map[x][y] = 1;
  412.     available_block++;
  413.     first_direction = direction;
  414.     degree = getGyroDegrees(S2);
  415.  
  416.     displayBigTextLine(2,"Available blocks");
  417.     displayBigTextLine(4,"      %d",available_block);
  418.  
  419.     if(getUSDistance(S4) > 25){
  420.         next_positionX = check_positionX(first_direction,x,y);
  421.         next_positionY = check_positionY(first_direction,x,y);
  422.         if(next_positionX < 0 || next_positionX >= n || next_positionY < 0 || next_positionY >= n){}
  423.         else {
  424.             assign_map(1,first_direction,x,y);
  425.             if(check_map[next_positionX][next_positionY] == 1) {}
  426.             else {
  427.                 forward();
  428.                 travel(next_positionX,next_positionY,first_direction);
  429.             }
  430.         }
  431.     }
  432.     check_direction(first_direction,direction);
  433.  
  434.     int a = check_right();
  435.     int b = check_left();
  436.     if(a > 25){
  437.         if(first_direction == 1){
  438.             direction = 2;
  439.         }
  440.         else if(first_direction == 2){
  441.             direction = 4;
  442.         }
  443.         else if(first_direction == 3){
  444.             direction = 1;
  445.         }
  446.         else if(first_direction == 4){
  447.             direction = 3;
  448.         }
  449.         next_positionX = check_positionX(direction,x,y);
  450.         next_positionY = check_positionY(direction,x,y);
  451.         if(next_positionX < 0 || next_positionX >= n || next_positionY < 0 || next_positionY >= n){}
  452.         else {
  453.             assign_map(2,first_direction,x,y);
  454.             if(check_map[next_positionX][next_positionY] == 1){
  455.                 chk = 0;
  456.             }
  457.             else {
  458.                 chk = 1;
  459.                 turn_right();
  460.                 forward();
  461.                 travel(next_positionX,next_positionY,direction);
  462.             }
  463.         }
  464.     }
  465.     if(chk == 1) check_direction(first_direction,direction);
  466.     chk = 0;
  467.  
  468.     a = check_left();
  469.     b = check_right();
  470.     if(a > 25){
  471.         if(first_direction == 1){
  472.             direction = 3;
  473.         }
  474.         else if(first_direction == 2){
  475.             direction = 1;
  476.         }
  477.         else if(first_direction == 3){
  478.             direction = 4;
  479.         }
  480.         else if(first_direction == 4){
  481.             direction = 2;
  482.         }
  483.         next_positionX = check_positionX(direction,x,y);
  484.         next_positionY = check_positionY(direction,x,y);
  485.         if(next_positionX < 0 || next_positionX >= n || next_positionY < 0 || next_positionY >= n){}
  486.         else {
  487.             assign_map(3,first_direction,x,y);
  488.             if(check_map[next_positionX][next_positionY] == 1){
  489.                 chk = 0;
  490.             }
  491.             else {
  492.                 chk = 1;
  493.                 turn_left();
  494.                 forward();
  495.                 travel(next_positionX,next_positionY,direction);
  496.             }
  497.         }
  498.     }
  499.     if(chk == 1) check_direction(first_direction,direction);
  500.    
  501.     if(x == 8 && y == 8) {}
  502.     else backward();
  503. }
  504.  
  505. void shortest(int x,int y,int _X,int _Y,int path){
  506.     if(path > short_map[x][y]) {
  507.         return;
  508.     }
  509.     if(path <= short_map[x][y]){
  510.         short_map[x][y] = path;
  511.     }
  512.     if(map_up[x][y] == 1){
  513.         shortest(x-1,y,_X,_Y,path+1);
  514.     }
  515.     if(map_right[x][y] == 1){
  516.         shortest(x,y+1,_X,_Y,path+1);
  517.     }
  518.     if(map_left[x][y] == 1){
  519.         shortest(x,y-1,_X,_Y,path+1);
  520.     }
  521.     if(map_down[x][y] == 1){
  522.         shortest(x+1,y,_X,_Y,path+1);
  523.     }
  524. }
  525.  
  526. void find_temp(int x,int y,int _X,int _Y,int path){
  527.     if(chk_finish == 1) return;
  528.    
  529.     position_temp[path][0] = x;
  530.     position_temp[path][1] = y;
  531.  
  532.     if(short_map[x][y] == 0){
  533.         chk_finish = 1;
  534.         return;
  535.     }
  536.     if(x-1 >= 0 && short_map[x-1][y] == path-1 && map_up[x][y] == 1){
  537.         find_temp(x-1,y,_X,_Y,path-1);
  538.     }
  539.     if(y+1 < n && short_map[x][y+1] == path-1 && map_right[x][y] == 1){
  540.         find_temp(x,y+1,_X,_Y,path-1);
  541.     }
  542.     if(y-1 >=0 && short_map[x][y-1] == path-1 && map_left[x][y] == 1){
  543.         find_temp(x,y-1,_X,_Y,path-1);
  544.     }
  545.     if(x+1 < n && short_map[x+1][y] == path-1 && map_down[x][y] == 1){
  546.         find_temp(x+1,y,_X,_Y,path-1);
  547.     }
  548. }
  549.  
  550. void rotate(int nowDirec, int nxtDirec){
  551.     if(nxtDirec == 1){
  552.         if(nowDirec == 2){
  553.             turn_left();
  554.         }else if(nowDirec == 3){
  555.             turn_right();
  556.         }else if(nowDirec == 4){
  557.             turn_right();
  558.             turn_right();
  559.         }
  560.     }else if(nxtDirec == 2){
  561.         if(nowDirec == 1){
  562.             turn_right();
  563.         }else if(nowDirec == 3){
  564.             turn_right();
  565.             turn_right();
  566.         }else if(nowDirec == 4){
  567.             turn_left();
  568.         }
  569.     }else if(nxtDirec == 3){
  570.         if(nowDirec == 1){
  571.             turn_left();
  572.         }else if(nowDirec == 2){
  573.             turn_right();
  574.             turn_right();
  575.         }else if(nowDirec == 4){
  576.             turn_right();
  577.         }
  578.     }else if(nxtDirec == 4){
  579.         if(nowDirec == 1){
  580.             turn_right();
  581.             turn_right();
  582.         }else if(nowDirec == 3){
  583.             turn_right();
  584.         }else if(nowDirec == 2){
  585.             turn_left();
  586.         }
  587.     }
  588. }
  589.  
  590. task main()
  591. {
  592.     int x=4,y=4;
  593.  
  594.     setSoundVolume(90);
  595.     checkSoundFile("Motor start");
  596.     wait1Msec(1000);
  597.     checkSoundFile("Motor start");
  598.     wait1Msec(1000);
  599.     checkSoundFile("Start up");
  600.    
  601.     resetGyro(S2);
  602.     resetMotorEncoder(motorB);
  603.     resetMotorEncoder(motorC);
  604.     resetMotorEncoder(motorA);
  605.     chk_finish = 0;
  606.  
  607.     for(int i=0;i<n;i++){
  608.         for(int j=0;j<n;j++){
  609.             check_map[i][j] = 0;
  610.             map_up[i][j] = 0;
  611.             map_down[i][j] = 0;
  612.             map_left[i][j] = 0;
  613.             map_right[i][j] = 0;
  614.             short_map[i][j] = 99;
  615.         }
  616.     }
  617.    
  618.     travel(n-1,n-1,1);
  619.  
  620.     checkSoundFile("Stop");
  621.     checkSoundFile("One");
  622.     checkSoundFile("Two");
  623.     checkSoundFile("Three");
  624.     wait1Msec(1000);
  625.     checkSoundFile("Comfirm");
  626.     wait1Msec(500);
  627.     checkSoundFile("Start");
  628.     wait1Msec(1000);
  629.  
  630.     shortest(n-1,n-1,n/2,n/2,0);
  631.     find_temp(x,y,8,8,short_map[x][y]);
  632.  
  633.     int direction = 1;
  634.     for(int i=0;i<short_map[x][y];i++){
  635.         if(position_temp[i][0] == position_temp[i+1][0] && position_temp[i][1]+1 == position_temp[i+1][1]){
  636.             if(direction != 2) {
  637.                 rotate(direction, 2);
  638.                 wait1Msec(2000);
  639.             }
  640.             direction = 2;
  641.         }else if(position_temp[i][0] == position_temp[i+1][0] && position_temp[i][1]-1 == position_temp[i+1][1]){
  642.             if(direction != 3) {
  643.                 rotate(direction, 3);
  644.                 wait1Msec(2000);
  645.             }
  646.             direction = 3;
  647.         }else if(position_temp[i][0]-1 == position_temp[i+1][0] && position_temp[i][1] == position_temp[i+1][1]){
  648.             if(direction != 1) {
  649.                 rotate(direction, 1);
  650.                 wait1Msec(2000);
  651.             }
  652.             direction = 1;
  653.         }else if(position_temp[i][0]+1 == position_temp[i+1][0] && position_temp[i][1] == position_temp[i+1][1]){
  654.             if(direction != 4) {
  655.                 rotate(direction, 4);
  656.                 wait1Msec(2000);
  657.             }
  658.             direction = 4;
  659.         }
  660.         forward();
  661.         wait1Msec(2000);
  662.     }
  663.  
  664.     for(int i=0;i<n;i++){
  665.             displayTextLine(i+2,"%3d%3d%3d%3d%3d%3d%3d%3d%3d",short_map[i][0],short_map[i][1],short_map[i][2],short_map[i][3],short_map[i][4],short_map[i][5],short_map[i][6],short_map[i][7],short_map[i][8]);
  666.     }
  667.  
  668.     displayTextLine(12,"   Available Blocks = %d",available_block);
  669.     displayTextLine(13,"   Shortest Path to (%d,%d) = %d",x,y,short_map[x][y]);
  670.  
  671.     checkSoundFile("Cheering");
  672.     checkSoundFile("Game over");
  673.     wait1Msec(500);
  674.     checkSoundFile("Elephant call");
  675.     checkSoundFile("Stop");
  676.  
  677.     wait1Msec(600000);
  678. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement