Advertisement
durdin

code2

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