No BSD License  

Highlights from
MATLAB Golf Contest Test Suite

from MATLAB Golf Contest Test Suite by Mike Thomas
Generates the test suites for the MATLAB Golf Contest.

createpathfinder
function holes = createpathfinder

holes = [];

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%EXAMPLE TAKEN FROM LUCIO's BOARD, same net multiple cases by permuting
bb=[10 2;13 2;17 1;17 3;19 4;18 7;14 6;12 4;12 7;14 8;1 6];
ll={'WlmLMAlm','bonopa','zzzzFzzzz','CBeqqqfQQQ','RED',...
   'gds','xxxICGGGGggggH','Viwiji','Juk','TkH','YyYyYW'};
clear q
for k=1:numel(ll)
q(k,upper(ll{k}))=1;
end
aa=(q*q')>0;

% CASE 1   
a=aa;
b=bb;
c = [1 11];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 2   
p = [4     8     7     6     5     1     9     3    10     2    11];
a = aa(p,p);
b = bb(p,:);
c = [1    10     6    11];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 3
p = [6    10     3    11     8     4     9     5     2     7     1];
a = aa(p,p);
b = bb(p,:);
c = [1    10     5     4];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 4
p = [3     6     5     2     7     4     9     1     8    11    10];
a = aa(p,p);
b = bb(p,:);
c = [1     6     4     8    10];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 5
p = [10     4    11     5     8     3     1     9     7     2     6];
a = aa(p,p);
b = bb(p,:);
c = [1     9     5     3];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%NED'S EXAMPLE
bb = [0 0; 0 4; 1 1; 2 2; 3 0; 3 3];
n = size(bb,1);
aa = eye(n);
aa([1 3],[1 3]) = ones(2);
aa([2 3],[2 3]) = ones(2);
aa([4 2],[4 2]) = ones(2);
aa([4 3],[4 3]) = ones(2);
aa([4 6],[4 6]) = ones(2);
aa([4 5],[4 5]) = ones(2);

% CASE 1
a=aa;
b=bb;
c=[1 3 4 5];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 2
p=[6     2     5     4     1     3];
a = aa(p,p);
b = bb(p,:);
b(2,2)=5;
c = [1 4 2];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;


% COMPLEX NET
bb = [1 1 1 1 2 2 2 2      9 10 11 12 13   3 4 6 7 3 4 6 7 5     ...
    5 6 7 5 6 7    13     16     12 13 14 15     20 20;...
    11 10 9 8 11 10 9 8  12 12 12 12 12   11 10 10 11 7 8 8 7 9 ...
    5 5 5  4 4 4    9      10     5 5 5 5         2  1]';
aa = zeros(36);
aa(1,[2 5 6])=1;
aa(2,[1 5 6 3 7])=1;
aa(3,[2 4 6 7 8])=1;
aa(4,[3 7 8])=1;
aa(5,[1 2 6 14])=1;
aa(6,[1 2 3 5 7])=1;
aa(7,[2 3 4 6 8])=1;
aa(8,[3 4 7 26])=1;
aa(9,[10])=1;
aa(10,[9 11])=1;
aa(11,[10 12])=1;
aa(12,[11 13])=1;
aa(13,[12 29])=1;
aa(14,[5 15])=1;
aa(15,[14 22])=1;
aa(16,[17 22])=1;
aa(17,[16 29])=1;
aa(18,[19])=1;
aa(19,[18 22])=1;
aa(20,[21 22])=1;
aa(21,[20 23])=1;
aa(22,[15 16 19 20])=1;
aa(23,[21 24])=1;
aa(24,[23 25])=1;
aa(25,[24 28])=1;
aa(26,[8 27])=1;
aa(27,[26 28])=1;
aa(28,[27 25])=1;
aa(29,[13 17 30])=1;
aa(30,[29 34])=1;
aa(31,[32])=1;
aa(32,[31 33])=1;
aa(33,[32 34])=1;
aa(34,[33 30 35])=1;
aa(35,[34 36])=1;
aa(36,[35])=1;

aa=aa|aa' + eye(36);

% CASE 1
a=aa;
b=bb;
c=[ 1     5    14    15    22    16    17    29    30    34    35    36];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 2
p=[9 2:8 1 10:36];
a = aa(p,p);
b = bb(p,:);
c=[1 10 11 12 13 29 17 16 22 20 21 23 24 25 28 27 26];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% CASE 3
p=[31 2:30 1 32:36];
a = aa(p,p);
b = bb(p,:);
c = [1 32 33 34 30 29 17 16 22 20 21 23 24 25 28 27 26];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;


% CASE 4
p=[22 2:21 1 23:36];
a = aa(p,p);
b = bb(p,:);
c = [1    16    17    29    30    34    35    36];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

% 2 link example
a = ones(2);
b = [0 0; 1 1];
c = [1 2];

holes(end+1).a = a;
holes(end).b = b;
holes(end).c = c;

Contact us at files@mathworks.com