Professional Documents
Culture Documents
19102A0056 - AI - Bot Save Princess
19102A0056 - AI - Bot Save Princess
19102A0056 - AI - Bot Save Princess
Experiment Number 6
Input format :- The first line contains an odd integer N (3 <= N <
100) denoting the size of the grid. This is followed by an NxN grid.
Each cell is denoted by ‘ - ’ (ASCII value: 45). The bot position is
denoted by ‘m’ and the princess position is denoted by ‘ p ’.
Output format :- Print out the moves you will take to rescue the
princess in one go. The moves must be separated by ‘\n’, a
newline.(The valid moves are LEFT or RIGHT or UP or DOWN.)
}
else if(found==2)
{ for(int i=n/2; i>0; i--)
printf("UP\n");
for(int j=n/2; j>0; j--)
printf("RIGHT\n");
}
else if(found==3)
{ for(int i=n/2; i>0; i--)
printf("DOWN\n");
for(int j=n/2; j>0; j--)
printf("LEFT\n");
}
else if(found==4)
{ for(int i=n/2; i>0; i--)
printf("DOWN\n");
for(int j=n/2; j>0; j--)
printf("RIGHT\n");
}
int main(void) {