function [x, y, C] = drawBranch(n)
% Create a branch of up to n connected points.
% First point is starting point at origin, marked by a red asterisk.
% The next set of points are user input, marked by cyan '+'s.
% The last two points are recursive connection points, marked by blue 'o's.
% x and y are position vectors: the kth point is located at (x(k),y(k)).
% Connectivity matrix C is symmetric and C(r,c) is 1 if point r and point c
%   are connected; otherwise it is 0.

n = abs(floor(n));  % n must be positive integer

% Initialializations
x = zeros(1,n);     % vector storing x positions
y = zeros(1,n);     % vector storing y positions
C = eye(n);         % n by n connectivity matrix, initialized with 1s along
                    %   the main diagonal since a point is connected to
                    %   itself.

figure
axis equal off
axis([-1 1 -1 1])
hold on
fill([-1 1 1 -1], [-1 -1 1 1], 'w')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% DO NOT MODIFY THE CODE ABOVE %%%%
%%%%     WRITE YOUR CODE BELOW    %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
