Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /// 1 = clean ; 0 = dirty
- /// 0 = A ; 1 = B ; 2 = C
- /// move = +1
- void agent(int x){
- if (x==0){
- printf("Enter the status of 'A' ");
- }
- else if (x==1){
- printf("Enter the status of 'B' ");
- }
- else if (x==2){
- printf("Enter the status of 'C' ");
- }
- }
- 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;
- printf("Enter the number tiles you want to arrive your machine\n");
- printf("0 = A ; 1 = B ; 2 = C\nEnter: ");
- scanf("%d",&tilesName);
- if (tilesName!=1){
- for (x=tilesName;x>=0;x--){
- agent(x);
- printf("1 = clean ; 0 = dirty\nEnter status : ");
- scanf("%d",&status);
- if (status==0){
- clean_point+=2;
- printf("Sucked\n");
- }
- else{
- printf("Cleaned\n");
- }
- }
- }
- while (count<1){
- for(x=0;x<2;x++){
- agent(left[x]);
- printf("1 = clean ; 0 = dirty\nEnter status : ");
- scanf("%d",&status);
- if (status==0){
- clean_point+=2;
- printf("Sucked\n");
- }
- else{
- printf("Cleaned\n");
- }
- }
- for(x=0;x<2;x++){
- agent(right[x]);
- printf("1 = clean ; 0 = dirty\nEnter status : ");
- scanf("%d",&status);
- if (status==0){
- clean_point+=2;
- printf("Sucked\n");
- }
- else{
- printf("Cleaned\n");
- }
- }
- count++;
- }
- printf("Total point %d",clean_point);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement