% MATLAB script to make 2x2 proofreading tiles % for the TwoCounterSquareCapped tiles N=59; % number of original tile types M=28; % number of original bond types origtiles={ % input from {21 21 25 25}, '(white) % seed' ,' ' {16 1 26 0}, '(red) % hor seed row 6' ,'E' {6 2 7 1}, '(red1) % hor seed row 5' ,'E' {5 3 7 2}, '(red2) % hor seed row 4' ,'E' {6 4 7 3}, '(red3) % hor seed row 3' ,'E' {5 24 7 4}, '(red4) % hor seed row 2' ,'E' {6 25 7 24}, '(red5) % hor seed row 1' ,'E' {1 16 0 26}, '(red) % vert seed row 6' ,'N' {2 6 1 7}, '(red1) % vert seed row 5' ,'N' {3 5 2 7}, '(red2) % vert seed row 4' ,'N' {4 6 3 7}, '(red3) % vert seed row 3' ,'N' {24 5 4 7}, '(red4) % vert seed row 2' ,'N' {25 6 24 7}, '(red5) % vert seed row 1' ,'N' {7 7 7 7}, '[.9](pink1) % blank 0 (small square)' ,'NE' {8 8 8 8}, '[.9](pink2) % blank 1 (large square)' ,'SW' {5 12 17 12},' (blue3) % -- vertical counter' ,'SW' {6 12 18 12},' (green)' ,'SW' {17 10 6 10},' (blue2)' ,'SE' {18 10 5 11},' (green2)' ,'SE' {18 11 6 11},' (green3)' ,'SE' {17 11 5 11},' (blue1)' ,'SE' {20 8 13 12}, '(magenta1)' ,'SW' {21 8 14 12}, '(magenta2)' ,'SW' {13 8 21 10}, '[1.5](magenta3)' ,'S from W' {14 8 20 11}, '[1.5](magenta4)' ,'S from W' {15 12 22 0}, '[1.5](grey20)' ,'S from E' {16 12 23 0}, '[1.5](grey30)' ,'S from E' {27 10 16 0}, '(grey40)' ,'SE' {23 10 15 0}, '(grey50)' ,'SE' {22 11 15 0}, '(grey60)' ,'SE' {23 11 16 0}, '(grey70)' ,'SE' {12 5 12 17},' (blue3) % -- horizontal counter' ,'SW' {12 6 12 18},' (green)' ,'SW' {10 17 10 6},' (blue2)' ,'NW' {10 18 11 5},' (green2)' ,'NW' {11 18 11 6},' (green3)' ,'NW' {11 17 11 5},' (blue1)' ,'NW' {8 20 12 13}, '(magenta1)' ,'SW' {8 21 12 14}, '(magenta2)' ,'SW' {8 13 10 21}, '[1.5](magenta3)' ,'W from S' {8 14 11 20}, '[1.5](magenta4)' ,'W from S' {12 15 0 22}, '[1.5](grey20)' ,'W from N' {12 16 0 23}, '[1.5](grey30)' ,'W from N' {10 27 0 16}, '(grey40)' ,'NW' {10 23 0 15}, '(grey50)' ,'NW' {11 22 0 15}, '(grey60)' ,'NW' {11 23 0 16}, '(grey70)' ,'NW' {26 26 0 0}, '(yellow1) % cap keystone (small square)' ,'NE' {26 7 26 0}, '(green4) % vert cap 1 (small square)' ,'NE' {7 26 0 26}, '(green4) % hor cap 1 (small square)' ,'NE' {0 28 27 0}, '[1.5](yellow3) % cap keystone for vert counter' ,'S from E' {0 28 17 28}, '(gold) % cap 1 for vert counter' ,'SW' {0 28 13 28}, '(orange) % cap 2 for vert counter' ,'SW' {28 0 0 27}, '[1.5](yellow3) % cap keystone for hori counter' ,'W from N' {28 0 28 17}, '(gold) % cap 1 for hori counter' ,'SW' {28 0 28 13}, '(orange) % cap 2 for hori counter' ,'SW' {0 28 8 28}, '(brown) % hor cap for blank (big square)' ,'SW' {28 0 28 8}, '(brown) % vert cap for blank (big square)' ,'SW' {0 0 28 28}, '[2](yellow4) % cap keystone (big square)' ,'SW' } origG = [2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 1 2 1] %% this isn't actually used for making the proofreading tiles. (it is used for orig) %% proofreadings looks at input directions. prooftiles = cell(4*N,3); proofG = zeros(1,2*M+4*N); for n=1:N a=origtiles{n,1}{1}; if (a>0) ahat=a+M; else ahat=0; end b=origtiles{n,1}{2}; if (b>0) bhat=b+M; else bhat=0; end c=origtiles{n,1}{3}; if (c>0) chat=c+M; else chat=0; end d=origtiles{n,1}{4}; if (d>0) dhat=d+M; else dhat=0; end prooftiles{4*n-3,1} = {a 2*M+4*n-3 2*M+4*n-0 dhat }; prooftiles{4*n-3,2} = origtiles{n,2}; prooftiles{4*n-2,1} = {ahat bhat 2*M+4*n-2 2*M+4*n-3}; prooftiles{4*n-2,2} = origtiles{n,2}; prooftiles{4*n-1,1} = {2*M+4*n-2 b chat 2*M+4*n-1}; prooftiles{4*n-1,2} = origtiles{n,2}; prooftiles{4*n-0,1} = {2*M+4*n-0 2*M+4*n-1 c d }; prooftiles{4*n-0,2} = origtiles{n,2}; %% funky colors for one tile pL=find(origtiles{n,2}=='['); pR=find(origtiles{n,2}==']'); if isempty(pL) prooftiles{4*n-2,2} = ' '; else prooftiles{4*n-2,2} = origtiles{n,2}(pL:pR); end % For each tile, we know the direction of growth. Set internal bond strengths based on input strengths. % Output sticky end strengths are set by the tile that reads this one. inputdir = origtiles{n,3}; if strcmp(inputdir,'NE') proofG([a a+M b b+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [1 1 1 1 1 1 1 1]; for i=0:3, prooftiles{4*n-i,3}=inputdir; end elseif strcmp(inputdir,'NW') proofG([a a+M d d+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [1 1 1 1 1 1 1 1]; for i=0:3, prooftiles{4*n-i,3}=inputdir; end elseif strcmp(inputdir,'SE') proofG([c c+M b b+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [1 1 1 1 1 1 1 1]; for i=0:3, prooftiles{4*n-i,3}=inputdir; end elseif strcmp(inputdir,'SW') proofG([c c+M d d+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [1 1 1 1 1 1 1 1]; for i=0:3, prooftiles{4*n-i,3}=inputdir; end elseif inputdir(1)=='S' proofG([c c+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [2 1 1 2 1 1]; prooftiles{4*n-3,3}='SE'; prooftiles{4*n-2,3}='S'; prooftiles{4*n-1,3}='SW'; prooftiles{4*n-0,3}='S'; elseif inputdir(1)=='N' proofG([a a+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [2 1 1 2 1 1]; prooftiles{4*n-3,3}='N'; prooftiles{4*n-2,3}='NW'; prooftiles{4*n-1,3}='N'; prooftiles{4*n-0,3}='NE'; elseif inputdir(1)=='E' proofG([b b+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [2 1 2 1 1 1]; prooftiles{4*n-3,3}='E'; prooftiles{4*n-2,3}='SE'; prooftiles{4*n-1,3}='E'; prooftiles{4*n-0,3}='NE'; elseif inputdir(1)=='W' proofG([d d+M 2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [2 1 2 1 1 1]; prooftiles{4*n-3,3}='SW'; prooftiles{4*n-2,3}='W'; prooftiles{4*n-1,3}='NW'; prooftiles{4*n-0,3}='W'; else %% seed tile proofG([2*M+4*n-3 2*M+4*n-2 2*M+4*n-1 2*M+4*n-0]) = [2 1 1 2]; prooftiles{4*n-3,3}=' '; prooftiles{4*n-2,3}='W'; prooftiles{4*n-1,3}='NW'; prooftiles{4*n-0,3}='N'; end end %% Output origtiles and prooftiles to a file (thus, this file is real source) oname='TwoCounterSquareCapped.tiles'; fname='TwoCounterSquareCapped2x2.tiles'; f=fopen(oname,'w'); fprintf(f,'%% %s output from source make2x2tiles.m \n', oname); fprintf(f,['%% Modifies binarycap.tiles to use two perpendicular counters.\n' ... '%% This avoids prolonged facet exposure, and should yield\n' ... '%% lower error rates. Counter tiles are at higher concentration\n' ... '%% to make counter growth and blank growth rates similar.\n' ... '%% Also, using unique bonds for the two layers of the counter growth\n' ... '%% (forward and backward) eliminates some spurious growth on those facets.\n']); fprintf(f,'tile edges matches {{N E S W}*}\n'); fprintf(f,'num tile types=%d\n', N); fprintf(f,'num binding types=%d\n', M); fprintf(f,'tile edges={\n'); for n=1:N fprintf(f,'{%d %d %d %d}%s \n', ... origtiles{n,1}{1}, origtiles{n,1}{2}, origtiles{n,1}{3}, origtiles{n,1}{4}, ... origtiles{n,2} ); end fprintf(f,'}\n'); fprintf(f,'binding strengths=\n{'); for i=1:M, fprintf(f,'%d ', origG(i)); end fprintf(f,'}\n'); fprintf(f,'size=64\nblock=10\nseed=50,8,1\nupdate_rate=50000\nGse=9\nGmc=17.7\n'); fclose(f); f=fopen(fname,'w'); fprintf(f,'%% %s generated by make2x2tiles.m from %s\n', fname,oname); fprintf(f,'tile edges matches {{N E S W}*}\n'); fprintf(f,'num tile types=%d\n', 4*N); fprintf(f,'num binding types=%d\n', 2*M+4*N); fprintf(f,'tile edges={\n'); for n=1:(4*N) fprintf(f,'{%d %d %d %d}%s \n', ... prooftiles{n,1}{1}, prooftiles{n,1}{2}, prooftiles{n,1}{3}, prooftiles{n,1}{4}, ... prooftiles{n,2} ); end fprintf(f,'}\n'); fprintf(f,'binding strengths=\n{'); for i=1:(2*M+4*N), fprintf(f,'%d ', proofG(i)); end fprintf(f,'}\n'); fprintf(f,'size=128\nblock=5\nseed=108,20,1\nupdate_rate=50000\nGse=9\nGmc=17.7\n'); fclose(f);