Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /// 1 = suck , 2 = move_left, 3= move_right
- /// 0 = A ; 1 = B ; 2 = C
- /// move = +1 , suck=2
- void agent(int x)
- {
- if (x==0)
- {
- printf("Enter the status of 'A' \n");
- }
- else if (x==1)
- {
- printf("Enter the status of 'B' \n");
- }
- else if (x==2)
- {
- printf("Enter the status of 'C' \n");
- }
- }
- int main()
- {
- int i[3] = {1,2,3};
- int left[2] = {i[0],i[1]};
- int right[2] = {i[2],i[1]};
- int tilesName,status,x,clean_point=0,count=0,path;
- printf("Enter the number tiles you want to arrive your machine\n");
- printf("0 = A ; 1 = B ; 2 = C\nEnter: ");
- scanf("%d",&tilesName);
- x = tilesName;
- while (clean_point<20)
- {
- agent(x);
- printf("1 = suck , 2 = move_left, 3= move_right\nEnter status : ");
- scanf("%d",&status);
- if (status==1)
- {
- clean_point+=2;
- printf("Sucked, you earned 2\n");
- }
- else if (status==2)
- {
- if (tilesName==0)
- {
- printf("You can Make illigal move left\n");
- continue;
- }
- clean_point--;
- x = --tilesName;
- }
- else if (status==3)
- {
- if (tilesName==2)
- {
- printf("You can Make illigal move to right\n");
- continue;
- }
- clean_point--;
- x = ++tilesName;
- }
- printf("point --> %d\n",clean_point);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement