-
-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathjonth.c
More file actions
127 lines (126 loc) · 2.45 KB
/
Copy pathjonth.c
File metadata and controls
127 lines (126 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#include <X11/Xlib.h>
#define G long i,j
#define K case
#define R return 0
#define S( x,y) for(x=0; x<y; x++)
#define I S(i,10
#define z I-6)B[t][u
#define t (X[m].b[i].i+g)
#define u (X[m].b[i].j+l)
#define M( x,y) XFillRectangles(D,p,x,a,y);
#define s B[i][j
#define W =XCreateGC(D,p,4,L)
#define E( W,_) k=0; I)S(j,22)if(W s]){ a[k].x=i*20; a[k].y=j*20+30; a[k].w=a[k].h=_; k++; }M(
#define A( W,_) &&!B[W]; if(!j){ z]=1; R; } else{ N(m); _; v(0); }
#define Q ]=0; I-6&&j)j=
#define F I-6)B[X[w].b[i].i+g][X[w].b[i].j+l
#define e( x) break; K x:q(c,j,x);
#define H (m){ G; I-6){ a[i].x=t*20; a[i].y=u*20+30; a[i].w=a[i].h=
#define v( _) d(m); z+_]=1; R+1;
struct{
short x,y,w,h;
} a[220],C;
struct{
struct{
G;
} b[4];
} X[99];
G,l,g=3,p,B[10][22],L[99],o[99],n,r,h,_[4],D,J,T;
f(){
*L=2;
n||XSendEvent(D,p,n=1,0,L),XFlush(D);
P();
}
Z(){
_[1]=_[3]=(9-h)*40000;
setitimer(0,_,0);
}
main(){
G,*_=(long*)X;
char*c=
"*{{{ {}{{*{{{ {}* { {{*{{{ *{{{ {* {* * { {{ { { *{* { {* *{{{ *{{{ { * { { *{{{ {{ *{{ { {{* { {*{{ {{ {{ {* { {*{{ { *{{{{ *{{ {{ ";
for(; *c; )
*_++=(unsigned)(*c+++2)%4;
srand(time(0));
L[10]=32769;
D=XOpenDisplay(0);
L[1]=L[2]=XWhitePixel(D,j=XDefaultScreen(D));
XMap@p=XCreate@XRoot@j),0,0,200,470,2,0,1,0,2056,L));
XSelectInput(D,p,ExposureMask|KeyPressMask);
T W;
L[2]=XBlackPixel(D,j);
J W;{
G,O=0,c=0;
Z(P());
q(c,c,1);
for(; ; ){
i=lK();
j=c;
switch(i){
K 'k':c=q(c="$#&'(%)+,-*/01.3254"[c]-35,j,4)?c:j;
e('j')e('l')e(32)}
if(n){
if(!q(c,j,2)){
G,n;
for(j=21;j-1;j--){
n=1;
I&&n)n=s];
n&&(X9(j++),O++);
}
n=0;
I&&!n)n=B[i][21];
Y();
r++;
c=rand()%19;
if(!q(c,c,3))
R+puts(L);
U(Z(h=O/9));
}
n=0;
}
}
}
}
Y(){
G,E(,19)J,k)E(!,20)T,k)U();
}
lK(){
XNextEvent(D,o);
switch(*o){
K 2:R+o[2]?0:XKeycodeToKeysym(D,((XKeyEvent*)o)->keycode,0);K 12:Y();}R;}d H 19;}M(J,4)}N H 20;}M(T,4)}q(m,w,k){
G=1;switch(k){
K 1:z+l]=1;
d(m);R+1;
K 'j':z Q t A(t-1][u,g--)K 'l':z Q t<9
A(1+t][u,g++)K 4:F Q
u<22&&t>=0&&t<10&&!B[t][u ];
if(!j){
F]=1;
R;
}
N(w);
v(0)K 32:for(;
q(m,m,2);
)n=r++;
R+1;
K 3:l=0;
g=3;
I-6&&j)j=!B[t][u+l ];
if(!j)R;
v(l)K 2:z Q(u+1)<22 A(t][u+1,l++)}
R;
}
X9(_){
G;
for(j=_; j; j--)I)s]=s-1];
}
U(){
void*a=&C;
C.w=200;
C.h=30;
M(T,1);
sprintf(L,"Score%9d Level%9d",r,h);
XDrawString(D,p,J,7,15,L,29);}
P(){
signal(14,f);
}