Advertisement
durdin

code3

Feb 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. #include <stdio.h>
  2. /// 1 = suck , 2 = move_left, 3= move_right
  3. /// 0 = A ; 1 = B ; 2 = C
  4. /// move = +1 , suck=2
  5. void agent(int x)
  6. {
  7.     if (x==0)
  8.     {
  9.         printf("Enter the status of 'A' \n");
  10.     }
  11.     else if (x==1)
  12.     {
  13.         printf("Enter the status of 'B' \n");
  14.     }
  15.     else if (x==2)
  16.     {
  17.         printf("Enter the status of 'C' \n");
  18.     }
  19. }
  20. int main()
  21. {
  22.     int i[3] = {1,2,3};
  23.     int left[2] = {i[0],i[1]};
  24.     int right[2] = {i[2],i[1]};
  25.     int tilesName,status,x,clean_point=0,count=0,path;
  26.     printf("Enter the number tiles you want to arrive your machine\n");
  27.     printf("0 = A ; 1 = B ; 2 = C\nEnter: ");
  28.     scanf("%d",&tilesName);
  29.     x = tilesName;
  30.     while (clean_point<20)
  31.     {
  32.         agent(x);
  33.         printf("1 = suck , 2 = move_left, 3= move_right\nEnter status : ");
  34.         scanf("%d",&status);
  35.         if (status==1)
  36.         {
  37.             clean_point+=2;
  38.             printf("Sucked, you earned 2\n");
  39.  
  40.         }
  41.         else if (status==2)
  42.         {
  43.             if (tilesName==0)
  44.             {
  45.                 printf("You can Make illigal move left\n");
  46.                 continue;
  47.             }
  48.             clean_point--;
  49.             x = --tilesName;
  50.         }
  51.         else if (status==3)
  52.         {
  53.             if (tilesName==2)
  54.             {
  55.                 printf("You can Make illigal move to right\n");
  56.                 continue;
  57.             }
  58.             clean_point--;
  59.             x = ++tilesName;
  60.         }
  61.         printf("point --> %d\n",clean_point);
  62.     }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement