{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":60618,"title":"ICFP2024 005: Lambdaman 1, 2, 3","description":"The ICFP2024 contest was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\r\nThe ICFP Language is based on Lambda Calculus.\r\nThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\r\nThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\r\nThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\r\n\r\nThe ICFP competition is more about manual solving optimizations for each unique problem.\r\nThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 315px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 157.5px; transform-origin: 407px 157.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/task.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP2024 contest\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 300px 8px; transform-origin: 300px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/icfp.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP Language\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.5px 8px; transform-origin: 40.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Lambda_calculus\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eLambda Calculus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 356.5px 8px; transform-origin: 356.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 357.5px 8px; transform-origin: 357.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 332px 8px; transform-origin: 332px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 285.5px 8px; transform-origin: 285.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 379.5px 8px; transform-origin: 379.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [pathbest]=Lambdaman_123(m)\r\n Lmax=Inf;\r\n %m  % Wall0 Lambda1 Cheese2 Eaten3\r\n [nr,nc]=size(m);\r\n adj=[-1 1 -nr nr]; % using index requires a wall ring around maze\r\n \r\n pathn=''; %UDLR\r\n ztic=tic;tmax=35; %Recursion time limit\r\n Lbest=inf;\r\n pathbest='';\r\n mstate=m(:)'; % recursion performs maze state checks to avoid dupolication\r\n mstaten=mstate;\r\n L=0;\r\n mn=m;\r\n Lidxn=find(m==1);\r\n [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L, ...\r\n   pathn,mn,Lidxn,mstaten,Lmax); %use VARn for recursion updates\r\n\r\n toc(ztic)\r\nend %Lambda_123\r\n\r\nfunction [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L, ...\r\n  path,m,Lidx,mstate,Lmax)\r\n\r\n%Conditional recursion aborts\r\n if toc(ztic)\u003etmax,return;end %Recursion time-out\r\n if L\u003eLmax,return;end % Limit recursion trials to known Lmax\r\n if L\u003e=Lbest,return;end % Bail on long solutions\r\n \r\n m(Lidx)=3;\r\n if nnz(m==2)==0 % Solution case. Better solution found\r\n  Lbest=L;\r\n  pathbest=path;\r\n  toc(ztic)\r\n  fprintf('Lbest=%i ',Lbest);fprintf('Path=%s',pathbest);fprintf('\\n\\n');\r\n  return;\r\n end\r\n \r\n UDLR='UDLR';\r\n \r\n mn=m;\r\n Cadj=m(adj+Lidx);\r\n for i=1:4 % UDLR\r\n  if Cadj(i)\u003e0 % Ignore into wall Cadj==0 movement\r\n   Lidxn=Lidx+adj(i);\r\n   mn(Lidxn)=1;\r\n   mn_state=mn(:)';\r\n   \r\n   if nnz(sum(abs(mstate-mn_state),2)==0) % Pre-exist state check\r\n    mn(Lidxn)=m(Lidxn); % Reset mn\r\n    continue; %Abort when create an existing prior state\r\n   end\r\n   \r\n   mstaten=[mstate;mn_state]; % When update walls re-init mstate\r\n   pathn=[path UDLR(i)];\r\n   \r\n   [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L+1, ...\r\n     pathn,mn,Lidxn,mstaten,Lmax);\r\n   \r\n   mn(Lidxn)=m(Lidxn); % reset mn in fastest way\r\n  end\r\n end % for UDLR\r\nend %maze_rec","test_suite":"%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 1  optimal solution L15 LLLDURRRUDRRURR\r\nms=['###.#...'\r\n    '...L..##'\r\n    '.#######'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 2  optimal solution L26 RDURRDDRRUUDDLLLDLLDDRRRUR\r\nms=['L...#.'\r\n    '#.#.#.'\r\n    '##....'\r\n    '...###'\r\n    '.##..#'\r\n    '....##'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 3  optimal solution L40 DRDRLLLUDLLUURURLLURLUURRDRDRDRDUUUULDLU\r\nms=[  '......'\r\n      '.#....'\r\n      '..#...'\r\n      '...#..'\r\n      '..#L#.'\r\n      '.#...#'\r\n      '......'];\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":3097,"edited_at":"2024-07-13T05:35:58.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-07-13T05:05:28.000Z","updated_at":"2026-03-11T09:46:10.000Z","published_at":"2024-07-13T05:35:58.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/task.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP2024 contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/icfp.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP Language\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Lambda_calculus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLambda Calculus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":60623,"title":"ICFP2024 007: Lambdaman 1, 2, 3 Breadth Solver","description":"The ICFP2024 contest was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\r\nThe ICFP Language is based on Lambda Calculus.\r\nThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\r\nThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\r\nThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\r\n\r\nThe ICFP competition is more about manual solving optimizations for each unique problem.\r\nThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 315px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 157.5px; transform-origin: 407px 157.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/task.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP2024 contest\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 300px 8px; transform-origin: 300px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/icfp.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP Language\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.5px 8px; transform-origin: 40.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Lambda_calculus\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eLambda Calculus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 356.5px 8px; transform-origin: 356.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 357.5px 8px; transform-origin: 357.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 332px 8px; transform-origin: 332px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 285.5px 8px; transform-origin: 285.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 379.5px 8px; transform-origin: 379.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function pathbest = Lambdaman_123(m)\r\n% Maze 1 solves in 15 so max states is 4^15=1.07e9\r\n% Each depth loop creates all new legal states from prior depth states\r\n% Maze 3 Fails miserably for pure breadth so key throat points checked for uneaten cheese\r\n%History of prior states maintained to eliminate duplicated states\r\n [nr,nc]=size(m);\r\n adj=[-1 1 -nr nr];\r\n bn2=nnz(m(:)==2);\r\n stateh=zeros(20000,nr*nc,'int8');\r\n spath=zeros(20000,15,'uint8');\r\n c2=nnz(m(:)==2);\r\n statec2=ones(20000,1)*c2;\r\n stateh(1,:)=m(:);\r\n sptr=1; eptr=1;\r\n enptr=eptr;\r\n depth=0;\r\n \r\n m3=nr*nc==72; % Hack for Lambdaman3\r\n \r\n while c2\u003e0\r\n  depth=depth+1;\r\n  fprintf('Depth:%i sptr:%i eptr:%i\\n',depth,sptr,eptr)\r\n  for hptr=sptr:eptr\r\n   ms=stateh(hptr,:);\r\n   \r\n   Lidx=find(ms==1);\r\n   \r\n   if m3 % Hack for Lambdaman3: Check chokepoints for completion\r\n    if Lidx==26 \u0026\u0026 nnz(ms([62 52 34])==2),continue;end %Lower grp\r\n    if Lidx==26 \u0026\u0026 ms(17)==3,continue;end % turn aroud\r\n    if Lidx==12 \u0026\u0026 nnz(ms([24 22 32 14])==2),continue;end %Left grp\r\n    if Lidx==12 \u0026\u0026 ms(11)==3,continue;end % turn aroud\r\n    if Lidx==20 \u0026\u0026 ms(29)==3,continue;end % turn aroud\r\n   end\r\n   \r\n   Cadj=ms(adj+Lidx);\r\n   msn=ms;\r\n   msn(Lidx)=3; %Lambdaman will move\r\n   for i=1:4 % UDLR\r\n    if Cadj(i)==0,continue;end % Ignore into wall Cadj==0 movement\r\n     Lidxn=Lidx+adj(i);\r\n     msn(Lidxn)=1;\r\n     \r\n     c2=nnz(msn==2);\r\n     ptr1=find(msn==2,1,'first');\r\n     ptr2=find(msn==2,1,'last');\r\n     cvec=statec2(1:enptr)==c2; % Reduce vector check only to c2 qty vectors\r\n     cvec=cvec \u0026 stateh(1:enptr,Lidxn)==1 \u0026 stateh(1:enptr,ptr1)==2 \u0026 stateh(1:enptr,ptr2)==2;\r\n     if nnz(cvec) % Perform a check\r\n      if nnz(sum(abs(stateh(cvec,:)-msn),2)==0) %23K/1.9s Pre-exist state check\r\n        msn(Lidxn)=ms(Lidxn); % Reset msn\r\n       continue; %Abort when create an existing prior state\r\n      end\r\n     end\r\n     \r\n     enptr=enptr+1; % new valid state\r\n     spath(enptr,:)=spath(hptr,:);\r\n     spath(enptr,depth)=i; % UDLR as 1 2 3 4\r\n     stateh(enptr,:)=msn;\r\n     msn(Lidxn)=ms(Lidxn); % Reset msn\r\n     statec2(enptr)=c2;\r\n          \r\n     if c2==0,break;end\r\n   end % UDLR\r\n   if c2==0\r\n    eptr=enptr;\r\n    break;\r\n   end\r\n   \r\n  end % hptr\r\n  sptr=eptr+1; % update wave\r\n  eptr=enptr;\r\n   \r\n end % while  c2\u003e0\r\n \r\n UDLR='UDLR';\r\n pathbest=UDLR(spath(eptr,1:depth));\r\n fprintf('BestPath:');fprintf('%s',pathbest);fprintf('\\n')\r\n  \r\nend %maze_breadth","test_suite":"%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 1  optimal solution L15 LLLDURRRUDRRURR\r\nms=['###.#...'\r\n    '...L..##'\r\n    '.#######'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==15\r\n  valid=1;\r\n else\r\n  fprintf('Length 15 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 2  optimal solution L26 RDURRDDRRUUDDLLLDLLDDRRRUR\r\nms=['L...#.'\r\n    '#.#.#.'\r\n    '##....'\r\n    '...###'\r\n    '.##..#'\r\n    '....##'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\n\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==26\r\n  valid=1;\r\n else\r\n  fprintf('Length 26 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 3  optimal solution L40 DRDRLLLUDLLUURURLLURLUURRDRDRDRDUUUULDLU\r\nms=[  '......'\r\n      '.#....'\r\n      '..#...'\r\n      '...#..'\r\n      '..#L#.'\r\n      '.#...#'\r\n      '......'];\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==40\r\n  valid=1;\r\n else\r\n  fprintf('Length 40 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":3097,"edited_at":"2024-07-14T03:49:34.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-07-13T14:56:14.000Z","updated_at":"2025-12-08T21:14:18.000Z","published_at":"2024-07-14T03:49:34.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/task.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP2024 contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/icfp.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP Language\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Lambda_calculus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLambda Calculus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":60618,"title":"ICFP2024 005: Lambdaman 1, 2, 3","description":"The ICFP2024 contest was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\r\nThe ICFP Language is based on Lambda Calculus.\r\nThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\r\nThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\r\nThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\r\n\r\nThe ICFP competition is more about manual solving optimizations for each unique problem.\r\nThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 315px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 157.5px; transform-origin: 407px 157.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/task.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP2024 contest\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 300px 8px; transform-origin: 300px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/icfp.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP Language\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.5px 8px; transform-origin: 40.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Lambda_calculus\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eLambda Calculus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 356.5px 8px; transform-origin: 356.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 357.5px 8px; transform-origin: 357.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 332px 8px; transform-origin: 332px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 285.5px 8px; transform-origin: 285.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 379.5px 8px; transform-origin: 379.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [pathbest]=Lambdaman_123(m)\r\n Lmax=Inf;\r\n %m  % Wall0 Lambda1 Cheese2 Eaten3\r\n [nr,nc]=size(m);\r\n adj=[-1 1 -nr nr]; % using index requires a wall ring around maze\r\n \r\n pathn=''; %UDLR\r\n ztic=tic;tmax=35; %Recursion time limit\r\n Lbest=inf;\r\n pathbest='';\r\n mstate=m(:)'; % recursion performs maze state checks to avoid dupolication\r\n mstaten=mstate;\r\n L=0;\r\n mn=m;\r\n Lidxn=find(m==1);\r\n [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L, ...\r\n   pathn,mn,Lidxn,mstaten,Lmax); %use VARn for recursion updates\r\n\r\n toc(ztic)\r\nend %Lambda_123\r\n\r\nfunction [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L, ...\r\n  path,m,Lidx,mstate,Lmax)\r\n\r\n%Conditional recursion aborts\r\n if toc(ztic)\u003etmax,return;end %Recursion time-out\r\n if L\u003eLmax,return;end % Limit recursion trials to known Lmax\r\n if L\u003e=Lbest,return;end % Bail on long solutions\r\n \r\n m(Lidx)=3;\r\n if nnz(m==2)==0 % Solution case. Better solution found\r\n  Lbest=L;\r\n  pathbest=path;\r\n  toc(ztic)\r\n  fprintf('Lbest=%i ',Lbest);fprintf('Path=%s',pathbest);fprintf('\\n\\n');\r\n  return;\r\n end\r\n \r\n UDLR='UDLR';\r\n \r\n mn=m;\r\n Cadj=m(adj+Lidx);\r\n for i=1:4 % UDLR\r\n  if Cadj(i)\u003e0 % Ignore into wall Cadj==0 movement\r\n   Lidxn=Lidx+adj(i);\r\n   mn(Lidxn)=1;\r\n   mn_state=mn(:)';\r\n   \r\n   if nnz(sum(abs(mstate-mn_state),2)==0) % Pre-exist state check\r\n    mn(Lidxn)=m(Lidxn); % Reset mn\r\n    continue; %Abort when create an existing prior state\r\n   end\r\n   \r\n   mstaten=[mstate;mn_state]; % When update walls re-init mstate\r\n   pathn=[path UDLR(i)];\r\n   \r\n   [pathbest,Lbest]=maze_rec(ztic,tmax,adj,pathbest,Lbest,L+1, ...\r\n     pathn,mn,Lidxn,mstaten,Lmax);\r\n   \r\n   mn(Lidxn)=m(Lidxn); % reset mn in fastest way\r\n  end\r\n end % for UDLR\r\nend %maze_rec","test_suite":"%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 1  optimal solution L15 LLLDURRRUDRRURR\r\nms=['###.#...'\r\n    '...L..##'\r\n    '.#######'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 2  optimal solution L26 RDURRDDRRUUDDLLLDLLDDRRRUR\r\nms=['L...#.'\r\n    '#.#.#.'\r\n    '##....'\r\n    '...###'\r\n    '.##..#'\r\n    '....##'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 3  optimal solution L40 DRDRLLLUDLLUURURLLURLUURRDRDRDRDUUUULDLU\r\nms=[  '......'\r\n      '.#....'\r\n      '..#...'\r\n      '...#..'\r\n      '..#L#.'\r\n      '.#...#'\r\n      '......'];\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nv = Lambdaman_123(m);\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n valid=1;\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nassert(valid)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":3097,"edited_at":"2024-07-13T05:35:58.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-07-13T05:05:28.000Z","updated_at":"2026-03-11T09:46:10.000Z","published_at":"2024-07-13T05:35:58.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/task.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP2024 contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/icfp.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP Language\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Lambda_calculus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLambda Calculus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a near brute force recursion with a time limit. Optimal solutions are not required.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":60623,"title":"ICFP2024 007: Lambdaman 1, 2, 3 Breadth Solver","description":"The ICFP2024 contest was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\r\nThe ICFP Language is based on Lambda Calculus.\r\nThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\r\nThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\r\nThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\r\n\r\nThe ICFP competition is more about manual solving optimizations for each unique problem.\r\nThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 315px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 157.5px; transform-origin: 407px 157.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/task.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP2024 contest\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 300px 8px; transform-origin: 300px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 14.5px 8px; transform-origin: 14.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://icfpcontest2024.github.io/icfp.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eICFP Language\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 40.5px 8px; transform-origin: 40.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e is based on \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://en.wikipedia.org/wiki/Lambda_calculus\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eLambda Calculus\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 356.5px 8px; transform-origin: 356.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 357.5px 8px; transform-origin: 357.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 332px 8px; transform-origin: 332px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 285.5px 8px; transform-origin: 285.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 379.5px 8px; transform-origin: 379.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function pathbest = Lambdaman_123(m)\r\n% Maze 1 solves in 15 so max states is 4^15=1.07e9\r\n% Each depth loop creates all new legal states from prior depth states\r\n% Maze 3 Fails miserably for pure breadth so key throat points checked for uneaten cheese\r\n%History of prior states maintained to eliminate duplicated states\r\n [nr,nc]=size(m);\r\n adj=[-1 1 -nr nr];\r\n bn2=nnz(m(:)==2);\r\n stateh=zeros(20000,nr*nc,'int8');\r\n spath=zeros(20000,15,'uint8');\r\n c2=nnz(m(:)==2);\r\n statec2=ones(20000,1)*c2;\r\n stateh(1,:)=m(:);\r\n sptr=1; eptr=1;\r\n enptr=eptr;\r\n depth=0;\r\n \r\n m3=nr*nc==72; % Hack for Lambdaman3\r\n \r\n while c2\u003e0\r\n  depth=depth+1;\r\n  fprintf('Depth:%i sptr:%i eptr:%i\\n',depth,sptr,eptr)\r\n  for hptr=sptr:eptr\r\n   ms=stateh(hptr,:);\r\n   \r\n   Lidx=find(ms==1);\r\n   \r\n   if m3 % Hack for Lambdaman3: Check chokepoints for completion\r\n    if Lidx==26 \u0026\u0026 nnz(ms([62 52 34])==2),continue;end %Lower grp\r\n    if Lidx==26 \u0026\u0026 ms(17)==3,continue;end % turn aroud\r\n    if Lidx==12 \u0026\u0026 nnz(ms([24 22 32 14])==2),continue;end %Left grp\r\n    if Lidx==12 \u0026\u0026 ms(11)==3,continue;end % turn aroud\r\n    if Lidx==20 \u0026\u0026 ms(29)==3,continue;end % turn aroud\r\n   end\r\n   \r\n   Cadj=ms(adj+Lidx);\r\n   msn=ms;\r\n   msn(Lidx)=3; %Lambdaman will move\r\n   for i=1:4 % UDLR\r\n    if Cadj(i)==0,continue;end % Ignore into wall Cadj==0 movement\r\n     Lidxn=Lidx+adj(i);\r\n     msn(Lidxn)=1;\r\n     \r\n     c2=nnz(msn==2);\r\n     ptr1=find(msn==2,1,'first');\r\n     ptr2=find(msn==2,1,'last');\r\n     cvec=statec2(1:enptr)==c2; % Reduce vector check only to c2 qty vectors\r\n     cvec=cvec \u0026 stateh(1:enptr,Lidxn)==1 \u0026 stateh(1:enptr,ptr1)==2 \u0026 stateh(1:enptr,ptr2)==2;\r\n     if nnz(cvec) % Perform a check\r\n      if nnz(sum(abs(stateh(cvec,:)-msn),2)==0) %23K/1.9s Pre-exist state check\r\n        msn(Lidxn)=ms(Lidxn); % Reset msn\r\n       continue; %Abort when create an existing prior state\r\n      end\r\n     end\r\n     \r\n     enptr=enptr+1; % new valid state\r\n     spath(enptr,:)=spath(hptr,:);\r\n     spath(enptr,depth)=i; % UDLR as 1 2 3 4\r\n     stateh(enptr,:)=msn;\r\n     msn(Lidxn)=ms(Lidxn); % Reset msn\r\n     statec2(enptr)=c2;\r\n          \r\n     if c2==0,break;end\r\n   end % UDLR\r\n   if c2==0\r\n    eptr=enptr;\r\n    break;\r\n   end\r\n   \r\n  end % hptr\r\n  sptr=eptr+1; % update wave\r\n  eptr=enptr;\r\n   \r\n end % while  c2\u003e0\r\n \r\n UDLR='UDLR';\r\n pathbest=UDLR(spath(eptr,1:depth));\r\n fprintf('BestPath:');fprintf('%s',pathbest);fprintf('\\n')\r\n  \r\nend %maze_breadth","test_suite":"%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 1  optimal solution L15 LLLDURRRUDRRURR\r\nms=['###.#...'\r\n    '...L..##'\r\n    '.#######'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==15\r\n  valid=1;\r\n else\r\n  fprintf('Length 15 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 2  optimal solution L26 RDURRDDRRUUDDLLLDLLDDRRRUR\r\nms=['L...#.'\r\n    '#.#.#.'\r\n    '##....'\r\n    '...###'\r\n    '.##..#'\r\n    '....##'];\r\n\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\n\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\n\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==26\r\n  valid=1;\r\n else\r\n  fprintf('Length 26 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n\r\n%%\r\nvalid=0;\r\n% L lambdaman 1,   . Cheese 2,   # Wall 0\r\n\r\n%Lambdaman 3  optimal solution L40 DRDRLLLUDLLUURURLLURLUURRDRDRDRDUUUULDLU\r\nms=[  '......'\r\n      '.#....'\r\n      '..#...'\r\n      '...#..'\r\n      '..#L#.'\r\n      '.#...#'\r\n      '......'];\r\n[nr,nc]=size(ms);\r\nmb=ones(nr,nc)*2; %Cheese bits are 2.\r\nmb(ms=='#')=0; % Wall\r\nmb(ms=='L')=1; % Landaman, start point\r\nm=zeros(nr+2,nc+2);\r\nm(2:end-1,2:end-1)=mb; %Wall surrounded maze\r\n[nr,nc]=size(m);\r\n\r\nfor i=1:nr % Display maze numeric\r\n fprintf('%i',m(i,:));fprintf('\\n');\r\nend\r\nztic=tic;\r\nv = Lambdaman_123(m);\r\ntoc(ztic)\r\nfprintf('Answer Length: %i\\n',length(v));\r\n\r\nmc=m==2; %Create cheese binary matrix for processing path coverage\r\n\r\n[r,c]=find(m==1); % Lambdaman\r\nfor i=1:length(v)\r\n if v(i)=='R' % R\r\n  if c+1\u003c=nc\r\n    if m(r,c+1)\u003e0\r\n     c=c+1;\r\n    end\r\n  end\r\n elseif v(i)=='L' % L\r\n  if c-1\u003e=1\r\n    if m(r,c-1)\u003e0\r\n     c=c-1;\r\n    end\r\n  end\r\n elseif v(i)=='U' % U\r\n  if r-1\u003e=1\r\n   if m(r-1,c)\u003e0\r\n     r=r-1;\r\n   end\r\n  end\r\n elseif v(i)=='D' % D\r\n  if r+1\u003c=nr\r\n    if m(r+1,c)\u003e0\r\n     r=r+1;\r\n    end\r\n  end\r\n end\r\n mc(r,c)=0; \r\n if nnz(mc)==0,break;end\r\nend\r\n\r\nif nnz(mc)==0\r\n if length(v)==40\r\n  valid=1;\r\n else\r\n  fprintf('Length 40 required. Given length:%i\\n',length(v));\r\n end\r\nelse\r\n fprintf('Failed to Clear - remaining cheesy bits\\n');\r\n for i=1:nr % Display maze numeric\r\n  fprintf('%i',mc(i,:));fprintf('\\n');\r\n end\r\nend\r\n\r\nzmap=[0 0 0;1 0 0;0 1 0;0 0 1]; % maps to 1:4\r\nfigure;image(m+1);colormap(zmap);axis equal;axis tight\r\n\r\nassert(valid)\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":3097,"edited_by":3097,"edited_at":"2024-07-14T03:49:34.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-07-13T14:56:14.000Z","updated_at":"2025-12-08T21:14:18.000Z","published_at":"2024-07-14T03:49:34.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/task.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP2024 contest\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e was held June29 thru July 1. The contest consisted of five parts: ICFP Language, Lambdaman maze, Starship flying, 3D - graph programming, and  Efficiency - processing complex ICFP message to a numerical value.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://icfpcontest2024.github.io/icfp.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eICFP Language\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e is based on \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://en.wikipedia.org/wiki/Lambda_calculus\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLambda Calculus\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe Lambdaman 1, 2, and 3 mazes are small matrices L at various indices,  '.' a cheese bit, # is Wall. Matrix uses Wall=0,L=1,Cheese=2. Encircling Walls are added to all mazes.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest goal was to write a minimal size, bytes, expression that moves L, Lambdaman, to eat each cheese bit.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe contest's best Lambdaman1, 2, and 3 solutions take 15, 26, and 40 U/R/D/L commands, respectively.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe ICFP competition is more about manual solving optimizations for each unique problem.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis challenge is to solve Lamdaman mazes 1, 2 and 3 by eating all the cheese via a char path of UDLR, with a common program smaller than the template. The template implements a breadth first search with prior state check.  Optimal length solutions are required.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"small cases\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"small cases\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"small cases\"","","\"","small cases","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f770769d900\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f770769d860\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f770769cfa0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f770769db80\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f770769dae0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f770769da40\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f770769d9a0\u003e":"tag:\"small cases\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f770769d9a0\u003e":"tag:\"small cases\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"small cases\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"small cases\"","","\"","small cases","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f770769d900\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f770769d860\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f770769cfa0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f770769db80\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f770769dae0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f770769da40\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f770769d9a0\u003e":"tag:\"small cases\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f770769d9a0\u003e":"tag:\"small cases\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":60618,"difficulty_rating":"easy"},{"id":60623,"difficulty_rating":"easy-medium"}]}}