# Homework Solution: Write a program using Matlab for Bug-0 (Robot): robot goes towards the goal. When it has faced wi…

Write a program using Matlab for Bug-0 (Robot): robot goes towards the goal. When it has faced with an obstacle follow the obstacle until the way to the goal is revealed. The algorithm is terminated when the goal is reached. There are several obstacles but here are two of them: 1.obstacle1.txt: 1 4 -8.052000 -6.720000 4.576000 7.933333 1.408000 8.353333 -11.000000 -5.040000 3 1 2 3 0 1 2. obstacle2.txt: 3 12 -8.140000 7.980000 -11.000000 6.953333 -12.320000 5.273333 -12.188000 3.406667 -11.088000 1.773333 -9.020000 1.120000 -7.304000 1.400000 -5.588000 2.286667 -4.224000 3.546667 -3.520000 5.413333 -4.312000 7.933333 -6.380000 8.586666 18 -9.108000 -9.613333 -8.888000 -10.593333 -7.612000 -10.686666 -5.500000 -9.566666 -3.124000 -7.420000 -0.088000 -4.106666 1.804000 -0.606667 3.256000 3.500000 4.268000 7.233333 5.148000 8.026666 5.148000 8.820000 4.488000 9.006666 2.728000 8.120000 1.188000 4.666666 0.484000 0.606667 -1.408000 -2.753333 -4.312000 -5.880000 -7.612000 -8.960000 6 7.832000 -0.980000 5.236000 -8.540000 9.988000 -10.500000 11.572000 -9.426666 7.524000 -7.793333 9.636000 -1.306667 Edit: The numbers in the .txt files are obstacles that are given for this project (check image below). The robot needs to run successfully for every different obstacle. For more information and to get access to the obstacles' files please check (Project1: Bug Algorithms) http://www.robotmotionplanning.org/TeachingRobotics.html#Project1Bug
obstacle1.txt obstacle2.txt

num = input('Enter a number: ');
p = 0; %even

Write a program using Matlab control Bug-0 (Robot): robot goes towards the appearance. When it has faced with an bar flourish the bar until the controlm to the appearance is biblical. The algorithm is terminated when the appearance is reached.

There are divers bars yet here are couple of them:

1.obstacle1.txt:

1
4
-8.052000 -6.720000
4.576000 7.933333
1.408000 8.353333
-11.000000 -5.040000
3 1 2
3 0 1

2. bar2.txt:

3

12
-8.140000 7.980000
-11.000000 6.953333
-12.320000 5.273333
-12.188000 3.406667
-11.088000 1.773333
-9.020000 1.120000
-7.304000 1.400000
-5.588000 2.286667
-4.224000 3.546667
-3.520000 5.413333
-4.312000 7.933333
-6.380000 8.586666

18
-9.108000 -9.613333
-8.888000 -10.593333
-7.612000 -10.686666
-5.500000 -9.566666
-3.124000 -7.420000
-0.088000 -4.106666
1.804000 -0.606667
3.256000 3.500000
4.268000 7.233333
5.148000 8.026666
5.148000 8.820000
4.488000 9.006666
2.728000 8.120000
1.188000 4.666666
0.484000 0.606667
-1.408000 -2.753333
-4.312000 -5.880000
-7.612000 -8.960000

6
7.832000 -0.980000
5.236000 -8.540000
9.988000 -10.500000
11.572000 -9.426666
7.524000 -7.793333
9.636000 -1.306667

Edit: The gum in the .txt files are bars that are ardent control this scheme (hinder copy under). The robot needs to speed successfully control complete irrelative bar. Control more knowledge and to secure arrival to the bars’ files fascinate hinder (Project1: Bug Algorithms) http://www.robotmotionplanning.org/TeachingRobotics.html#Project1Bug

obstacle1.txt bar2.txt

## Expert Acceptance

num = input('Enter a number: ');
p = 0; %even
im = 0; %odd
pos = 0; %positives
n = 0; %negatives
control x = 1; x <= 50; x = x+1;
if rem(num,2) == 0;
p = p + 1;
else
im = im + 1;
if num > 0
pos = pos + 1;
else
n = n + 1;
end
end
end

disp('the smooth gum are');
disp(p);
disp('the nondescript gum are')
disp(im);
disp('the absolute gum are')
disp(pos);
disp('the denying gum are')
disp(n);