diff --git a/2001/ctk/README.md b/2001/ctk/README.md index 23bcc7736..9762d3d59 100644 --- a/2001/ctk/README.md +++ b/2001/ctk/README.md @@ -17,12 +17,24 @@ make ./ctk ``` +[Yusuke Endoh](/winners.html#Yusuke_Endoh) provided a patch to fix the ANSI +escape codes. It became apparent to [Cody Boone +Ferguson](/winners.html#Cody_Boone_Ferguson) (when he was looking at the source +code of this entry) that it was no longer valid ANSI escape sequences. He has +used them before but that was a long time ago and with Yusuke's patch it works. +Cody notes that this fix will not just for linux but macOS too. Thank you Yusuke +for your assistance! + + ### Try: ```sh echo "Do or do not. There is no try." ``` +Make sure to hit 'q' to exit or else your terminal will be messed up (to restore +it you can try `stty sane` or `reset`). + ## Judges' comments: No matter how careful you are, this guy eventually crashes. Most people diff --git a/2001/ctk/ctk.c b/2001/ctk/ctk.c index b371fbee0..6aba6497c 100644 --- a/2001/ctk/ctk.c +++ b/2001/ctk/ctk.c @@ -10,7 +10,7 @@ char x[]="((((((((((((((((((((((",w[]= "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";char r[]={92,124,47},l[]={2,3,1 ,0};char*T[]={" |"," |","%\\|/%"," %%%",""};char d=1,p=40,o=40,k=0,*a,y,z,g= -1,G,X,**P=&T[4],f=0;unsigned int s=0;void u(int i){int n;printf( -"\233;%uH\233L%c\233;%uH%c\233;%uH%s\23322;%uH@\23323;%uH \n",*x-*w,r[d],*x+*w +"\x1b[H\x1b[L\x1b[;%uH%c\x1b[;%uH%c\x1b[;%uH%s\x1b[22;%uH@\x1b[23;%uH \n",*x-*w,r[d],*x+*w ,r[d],X,*P,p+=k,o);if(abs(p-x[21])>=w[21])exit(0);if(g!=G){struct itimerval t= {0,0,0,0};g+=((g> 3)+1);setitimer(0,&t,0);f&&printf("\e[10;%u]",g+24);}f&&putchar(7);s+=(9-w[21]