Merge pull request #1341 from xexyl/cmills1993-alt
Updates to 1993/cmills - alt code + bugs + format
This commit is contained in:
6 files changed
+127
-9
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
cmills
|
cmills
|
||||||
|
cmills.alt
|
||||||
cmills.orig
|
cmills.orig
|
||||||
prog.orig
|
prog.orig
|
||||||
@@ -57,11 +57,11 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE=
|
CDEFINE= -DZ=100
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# Include files that are needed to compile
|
||||||
#
|
#
|
||||||
CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11
|
CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 -include unistd.h
|
||||||
|
|
||||||
# Optimization
|
# Optimization
|
||||||
#
|
#
|
||||||
@@ -113,8 +113,8 @@ OBJ= ${PROG}.o
|
|||||||
DATA=
|
DATA=
|
||||||
TARGET= ${PROG}
|
TARGET= ${PROG}
|
||||||
#
|
#
|
||||||
ALT_OBJ=
|
ALT_OBJ= ${PROG}.alt.o
|
||||||
ALT_TARGET=
|
ALT_TARGET= ${PROG}.alt
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
@@ -141,6 +141,9 @@ chris: ${PROG}
|
|||||||
alt: data ${ALT_TARGET}
|
alt: data ${ALT_TARGET}
|
||||||
@${TRUE}
|
@${TRUE}
|
||||||
|
|
||||||
|
${PROG}: ${PROG}.c
|
||||||
|
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
|
||||||
|
|
||||||
# data files
|
# data files
|
||||||
#
|
#
|
||||||
data: ${DATA}
|
data: ${DATA}
|
||||||
|
|||||||
+45
-5
@@ -1,7 +1,18 @@
|
|||||||
## To build:
|
## To build:
|
||||||
|
|
||||||
|
We recommend you try the alt version first as with modern systems the original
|
||||||
|
goes too fast. See the [original code](#original-code) section below to run the
|
||||||
|
original.
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make all
|
make alt
|
||||||
|
```
|
||||||
|
|
||||||
|
To configure how many microseconds to sleep before updates try:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make clobber CDEFINE="-DZ=200" alt
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
NOTE: this entry requires `X11/Xlib.h` header file and the X11 library to
|
||||||
@@ -10,12 +21,24 @@ install [XQuartz](https://www.xquartz.org) in order to compile and run this
|
|||||||
entry.
|
entry.
|
||||||
|
|
||||||
|
|
||||||
|
### Bugs and (Mis)features:
|
||||||
|
|
||||||
|
The current status of this entry is:
|
||||||
|
|
||||||
|
```
|
||||||
|
STATUS: known bug - please help us fix
|
||||||
|
```
|
||||||
|
|
||||||
|
For more detailed information see [1993 cmills in bugs.md](/bugs.md#1993-cmills).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## To use:
|
## To use:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
DISPLAY="your_X_server_display"\
|
DISPLAY="your_X_server_display"
|
||||||
export DISPLAY
|
export DISPLAY
|
||||||
./cmills [speed] # must be run on an X11 server
|
./cmills.alt [speed] # must be run on an X11 server
|
||||||
```
|
```
|
||||||
|
|
||||||
where:
|
where:
|
||||||
@@ -23,9 +46,26 @@ where:
|
|||||||
`speed` is update speed from 1 to 9 (default is 9).
|
`speed` is update speed from 1 to 9 (default is 9).
|
||||||
|
|
||||||
|
|
||||||
|
## Original code:
|
||||||
|
|
||||||
|
We recommend the version that uses `usleep(3)` to more easily see what is going
|
||||||
|
on but you can use the original without any delays if you wish.
|
||||||
|
|
||||||
|
|
||||||
|
### Original build:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make all
|
||||||
|
```
|
||||||
|
|
||||||
|
### Original use:
|
||||||
|
|
||||||
|
Use `cmills` as you would `cmills.alt` above.
|
||||||
|
|
||||||
|
|
||||||
## Judges' remarks:
|
## Judges' remarks:
|
||||||
|
|
||||||
From the San Jose Mercury News (May 15, 1993 page 20A "West Hackers\
|
From the San Jose Mercury News (May 15, 1993 page 20A "West Hackers
|
||||||
trounce East in computer quiz game"):
|
trounce East in computer quiz game"):
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +83,7 @@ it brought down the house of Apple partisans...
|
|||||||
[The expression on Bill Gates' face was a sight to behold, as reported
|
[The expression on Bill Gates' face was a sight to behold, as reported
|
||||||
to us by several who were there].
|
to us by several who were there].
|
||||||
|
|
||||||
You must set `$DISPLAY` in your environment or the program will\
|
You must set `$DISPLAY` in your environment or the program will
|
||||||
dump core. This is not a bug as the author documented it as
|
dump core. This is not a bug as the author documented it as
|
||||||
a feature. :-)
|
a feature. :-)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
long
|
||||||
|
z[7992],W,H,*t=z,j,k,*T=z,n,b;
|
||||||
|
#include<X11/Xlib.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
Window*E,D,s,w[999],*e=w;
|
||||||
|
Display*d;
|
||||||
|
Pixmap
|
||||||
|
p;
|
||||||
|
m(w,h,x,y,u,v){
|
||||||
|
#define C XCreateSimpleWindow(d,
|
||||||
|
XSetWindowBackgroundPixmap(d,s=C*e=C
|
||||||
|
#define l(n)t[n]=T[n]+
|
||||||
|
D,l(0)x,l(1)y,t[2]=w,t[3]=h,1,b,0),l(6)-x,l(7)-y,W,H,0,0,0),p);
|
||||||
|
l(4)u;
|
||||||
|
l(5)v;
|
||||||
|
#define M XMapRaised(d,
|
||||||
|
M
|
||||||
|
s);
|
||||||
|
M*e++);
|
||||||
|
t+=8;
|
||||||
|
}
|
||||||
|
main(c,g)char**g;
|
||||||
|
{
|
||||||
|
XSetWindowAttributes
|
||||||
|
a;
|
||||||
|
XGCValues
|
||||||
|
v;
|
||||||
|
n=DefaultScreen(d=XOpenDisplay(0));
|
||||||
|
p=XCreatePixmap(d,D=RootWindow(d,n),W=DisplayWidth(d,n),H=DisplayHeight(d,n),DefaultDepth(d,n));
|
||||||
|
v.subwindow_mode=IncludeInferiors;
|
||||||
|
XCopyArea(d,D,p,XCreateGC(d,D,GCSubwindowMode,&v),0,0,W,H,0,0);
|
||||||
|
a.override_redirect=True;
|
||||||
|
XChangeWindowAttributes(d,D=C
|
||||||
|
D,0,0,W,H,0,0,b=BlackPixel(d,n)),CWOverrideRedirect,&a);
|
||||||
|
M
|
||||||
|
D);
|
||||||
|
m(W,H,0,0,3,3);
|
||||||
|
for(c=c^1?atoi(g[1]):9;
|
||||||
|
;
|
||||||
|
)for(T=z,n=e-(E=w);
|
||||||
|
n--;
|
||||||
|
T+=8,++E){
|
||||||
|
XMoveWindow(d,*E,*T+=T[4]*c,T[1]+=T[5]*c);
|
||||||
|
j=0;
|
||||||
|
#define F(n,o,s)o+T[n-4]s-0&&++j&&T[n]s!1&&(T[n]=0-T[n])||
|
||||||
|
if((F(4,0,<)F(4,T[2]-W,>)F(5,0,<)F(5,T[3]-H,>)1)&&j&&(j=T[2]/2)&&(k=T[3]/2)&&e-w<997&&rand()%32768<=T[2]*T[3]*(T[4]*T[4]+T[5]*T[5])/999){
|
||||||
|
m(T[2]-j,T[3]-k,j,k,2,2);
|
||||||
|
m(j,T[3]-k,0,k,-2,-2);
|
||||||
|
m(T[2]-j,k,j,0,2,-2);
|
||||||
|
T[7]-=2;
|
||||||
|
XResizeWindow(d,*E,T[2]=j,T[3]=k);
|
||||||
|
T[6]-=2;
|
||||||
|
}
|
||||||
|
usleep(Z);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -999,6 +999,16 @@ not a misunderstanding).
|
|||||||
# 1993
|
# 1993
|
||||||
|
|
||||||
|
|
||||||
|
### STATUS: known bug - please help us fix
|
||||||
|
### Source code: [1993/cmills/cmills.c](1993/cmills/cmills.c)
|
||||||
|
### Information: [1993/cmills/README.md](1993/cmills/README.md)
|
||||||
|
|
||||||
|
We are unsure if this is a problem with multiple platforms but in macOS at least
|
||||||
|
the program appears to just shows a black screen.
|
||||||
|
|
||||||
|
Can you fix it? We welcome your help.
|
||||||
|
|
||||||
|
|
||||||
## 1993 lmfjyh
|
## 1993 lmfjyh
|
||||||
|
|
||||||
### STATUS: INABIAF - please **DO NOT** fix
|
### STATUS: INABIAF - please **DO NOT** fix
|
||||||
|
|||||||
@@ -1570,6 +1570,14 @@ args (2). And not that we need the help or anything for this :-) but we
|
|||||||
encourage you to try the original :-)
|
encourage you to try the original :-)
|
||||||
|
|
||||||
|
|
||||||
|
## [1993/cmills](1993/cmills/cmills.c) ([README.md](1993/cmills/README.md]))
|
||||||
|
|
||||||
|
Yusuke suggested that with modern systems this goes too fast so he added a call
|
||||||
|
to `usleep(3)` in a patch he made. Cody made it configurable at compilation by
|
||||||
|
using a macro. This is in the alt version which is the recommended one to try
|
||||||
|
first.
|
||||||
|
|
||||||
|
|
||||||
## [1993/dgibson](1993/dgibson/dgibson.c) ([README.md](1993/dgibson/README.md]))
|
## [1993/dgibson](1993/dgibson/dgibson.c) ([README.md](1993/dgibson/README.md]))
|
||||||
|
|
||||||
Cody fixed the script to work which assumed that `.` is in the path.
|
Cody fixed the script to work which assumed that `.` is in the path.
|
||||||
|
|||||||
Reference in new issue
Block a user