
function success = makeDots()

symbols = 2;

dots = zeros(6,6,symbols);

dots(:,:,1) =  [...
	1 1 2 2 1 1; ...
	1 2 1 1 2 1; ...
	2 1 1 1 1 0; ...
	2 1 1 1 1 0; ...
	1 0 1 1 0 1; ...
	1 1 0 0 1 1];

dots(:,:,2) =  [...
	1 1 1 1 1 1; ...
	1 1 0 0 1 1; ...
	1 0 2 2 0 1; ...
	1 0 2 2 0 1; ...
	1 1 0 0 1 1; ...
	1 1 1 1 1 1];

dots = floor(dots * 127.5); %scale to 0 to 255

h = 4 * (18+1) * symbols - 1;
w = 16 * (12+1) - 1;

img = ones(h,w,3)*127;

%draw red lines
for i = 1:h
	for j = 1:w
		if (mod(i,18+1) == 0) || (mod(j,12+1) == 0)
			img(i,j,:) = [255 0 0];
		end
	end
end

%count to 64
count = 0;
for i = 1:4*symbols
	for j = 1:16
		drawDots(i, j, count, ceil(i / 4));
		count = count + 1;
	end
end


imwrite(img./255,'dots.png','PNG');

success = 'success';

%helper function to draw dots in cell
	function drawDots(i,j,count, dotN)
		for d = 0:5
			if(bitand(count,2^d) > 0)
				drawDot((i-1)*19 +1 +6*floor(d/2), (j-1)*13 +1 +6*mod(d,2),dotN);
			end
		end
	end

%helper function to draw one dot
	function drawDot(i,j,dotN)
		img(i:i+5,j:j+5,:) = repmat(dots(:,:,dotN),[1, 1, 3]);
	end

end

