From 341533cdedc51aae5e912fb846e6fb883de30f9f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 18 Mar 2023 06:56:55 -0700 Subject: [PATCH] Fix 1995/cdua under macOS It took two things: get it to compile and then remove bad function prototypes which were causing a segfault. It worked under linux and of course it still does. --- 1995/cdua/Makefile | 2 +- 1995/cdua/README.md | 16 +++++++++++----- 1995/cdua/cdua.c | 16 ++++++++-------- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/1995/cdua/Makefile b/1995/cdua/Makefile index 56fb177f5..dc976c648 100644 --- a/1995/cdua/Makefile +++ b/1995/cdua/Makefile @@ -97,7 +97,7 @@ CDEFINE= # Include files that are needed to compile # -CINCLUDE= +CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h diff --git a/1995/cdua/README.md b/1995/cdua/README.md index 9ab22f7ec..e38231763 100644 --- a/1995/cdua/README.md +++ b/1995/cdua/README.md @@ -11,17 +11,23 @@ make all +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this so that it +would work with macOS. Once it could compile it additionally segfaulted under +macOS (it did not under linux) which he also fixed. Thank you Cody for your +assistance! + + ### To run ./cdua ## Judges' comments - This could be used as the basis of an a-maze-ing screen exerciser. +This could be used as the basis of an a-maze-ing screen exerciser. ## Author's comments - A program that generates a maze, and then solves it, all this being - seen by the user. Some highlights of obfuscation are: 3 steps - functions in one - main(), several recursive calls with conditional - actions, and just one (big and ugly) statement to solve the maze. +A program that generates a maze, and then solves it, all this being +seen by the user. Some highlights of obfuscation are: 3 steps +functions in one - main(), several recursive calls with conditional +actions, and just one (big and ugly) statement to solve the maze. diff --git a/1995/cdua/cdua.c b/1995/cdua/cdua.c index b772090f0..38dcaa85a 100644 --- a/1995/cdua/cdua.c +++ b/1995/cdua/cdua.c @@ -4,13 +4,13 @@ char*u0=" to begin... ",*u1="Already been here!",*u2="Found a wall! \ ",*u3="Walking... ",*u4="Finished. ",*u5="Going back..\ . ",*o="\033[23;1HDone!!\n",*x="\033[2J",*y="\033[1;1H",*z="\033[%d;%\ dH%c",*w="\033[1;1H%s",*v="\033[%d;%dH%c\033[%d;%dH%c\033[%d;%dH%c",b[1841 -];int c,d,e,f,g;typedef int(*h)();h i,j,k,l,m,n;int printf(),srand(),rand( -),time(),getchar();int main(int a){i=printf,j=srand,k=rand,l=time,m=getchar, -n=main;if(!c)for(j(l(0)),g=a=1000,--d;++d<1840;b[c=d]=" #\n"[d%80==79?2:d/80 -&&d%80&&d/80-22&&d%80-78]);if(!(c-1839))++c,i("%s%s%s",x,y,b);k:if(!(c-1840) +];int c,d,e,f,g;typedef int(*h)();h i,k,l,m,n;rand( +),time(),getchar();int main(int a){k=rand,l=time,m=getchar, +n=main;if(!c)for(srand(l(0)),g=a=1000,--d;++d<1840;b[c=d]=" #\n"[d%80==79?2:d/80 +&&d%80&&d/80-22&&d%80-78]);if(!(c-1839))++c,printf("%s%s%s",x,y,b);k:if(!(c-1840) &&(b[a+2]+b[a-2]+b[a+160]+b[a-160]-4*' ')){while(b[a+(f=(e=k()%4)?e-1?e-2?-1 -:1:-80:80)*2]!='#');b[a]=b[a+f]=b[f+a+f]=' ';i(v,a/80+1,1+a%80,' ',(a+f)/80+ +:1:-80:80)*2]!='#');b[a]=b[a+f]=b[f+a+f]=' ';printf(v,a/80+1,1+a%80,' ',(a+f)/80+ 1,1+(a+f)%80,' ',(f+a+f)/80+1,1+(f+a+f)%80,' ');n(f+a+f);goto k;}else if(!(g --a))c=1,a=162,i(w,u0),m();if(c-1){}else r b[a]!=' '?(i(w,b[a]=='.'?u1:u2),0) -:(b[a]='.',i(w,u3),i(z,a/80+1,1+a%80,'.'),a==1676?(i(w,u4),i(o),1):n(a+1)||n -(a+80)||n(a-80)||n(a-1)?1:(b[a]=' ',i(w,u5),i(z,a/80+1,1+a%80,' '),0));r 0;} +-a))c=1,a=162,printf(w,u0),m();if(c-1){}else r b[a]!=' '?(printf(w,b[a]=='.'?u1:u2),0) +:(b[a]='.',printf(w,u3),printf(z,a/80+1,1+a%80,'.'),a==1676?(printf(w,u4),printf(o),1):n(a+1)||n +(a+80)||n(a-80)||n(a-1)?1:(b[a]=' ',printf(w,u5),printf(z,a/80+1,1+a%80,' '),0));r 0;}