Make 1995/cdua easier to see with modern systems
As modern systems are so much faster it's hard to see the maze being
solved in real time so I added a call to usleep() with a macro defined
in the Makefile (a macro in case someone finds it too slow or too fast
or wants to do some strange experiment like setting it to 40000 which I
actually tried). Called Z it defaults to 3000. To change it do something
like:
make CFLAGS+="-DZ=1500" clobber all
To do this I had to remove the -include ... from the Makefile and
instead add the proper #includes to the source code as the += was not
concatenating to the CFLAGS.
This makes the entry a bit more enjoyable with current systems. There
still is a known issue that I'll look at again another time.
This commit is contained in:
1 parent
2474269674
commit
4f022b6963
3 files changed
+28
-14
No files matched your search
+5
-1
@@ -1,3 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define r return
|
||||
|
||||
char*u0="<RET> to begin... ",*u1="Already been here!",*u2="Found a wall! \
|
||||
@@ -11,6 +15,6 @@ n=main;if(!c)for(srand(l(0)),g=a=1000,--d;++d<1840;b[c=d]=" #\n"[d%80==79?2:d/80
|
||||
&&(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]=' ';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,printf(w,u0),m();if(c-1){}else r b[a]!=' '?(printf(w,b[a]=='.'?u1:u2),0)
|
||||
-a))c=1,a=162,printf(w,u0),m();if(c-1){}else r b[a]!=' '?(usleep(Z),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;}
|
||||
Reference in new issue
Block a user