/[opencvs]/eyes/points.c
ViewVC logotype

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations)
Thu Mar 6 06:43:51 2014 UTC (4 years, 2 months ago) by hib
Branch: MAIN
Changes since 1.9: +41 -1 lines
File MIME type: text/plain
Got qi working and released.
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #define qi
5
6 #ifdef antique
7 #define WIDTH 16
8 #define HEIGHT 16
9 #endif
10
11 #ifdef salka
12 #define WIDTH 132
13 #define HEIGHT 136
14 #endif
15
16 #ifdef veronika
17 #define WIDTH 144
18 #define HEIGHT 48
19 #endif
20
21 #ifdef kelly
22 #define WIDTH 144
23 #define HEIGHT 48
24 #endif
25
26 #ifdef dad
27 #define WIDTH 18
28 #define HEIGHT 25
29 #endif
30
31 #ifdef liss
32 #define WIDTH 28
33 #define HEIGHT 21
34 #endif
35
36 #ifdef stephanie
37 #define WIDTH 32
38 #define HEIGHT 24
39 #endif
40
41
42 #ifdef moot
43 #define WIDTH 64
44 #define HEIGHT 50
45 #endif
46
47 #ifdef lovely1
48 #define WIDTH 32
49 #define HEIGHT 42
50 #endif
51
52 #ifdef cyclone
53 #define WIDTH 16
54 #define HEIGHT 16
55 #endif
56
57 #ifdef girl3
58 #define WIDTH 144
59 #define HEIGHT 48
60 #endif
61
62 #ifdef benflag
63 #define WIDTH 7
64 #define HEIGHT 5
65 #endif
66
67 #ifdef qi
68 #define WIDTH 16
69 #define HEIGHT 16
70 #endif
71
72 int there[WIDTH][HEIGHT];
73 int there2[WIDTH][HEIGHT];
74 int *pos;
75
76 int points (){
77 int width=WIDTH;
78 int height=HEIGHT;
79 int x,y;
80 int size;
81 pos = (int *) there2;
82 for (x=0;x<width;x++) {
83 for (y=0;y<height;y++) {
84 there[x][y] = 0;
85 pos[y*width+x] = y*width+x;
86 }
87 }
88 size=width*height;
89
90 int set(int x,int y,int c,int e)
91 {
92 there[x][y]=e;
93 int cc;cc=(c);
94 if (cc==-1) {
95 for (cc=0;cc<size;cc++) {
96 if (pos[cc]== (y*width+x)) break;
97 }
98 if (cc==size) {
99 fprintf(stderr,"huh??????error\n");
100 exit(-1);
101 }
102 }
103 if (e>0) printf("%010d|%d|%d\n",e,x,y);
104 size=size-1;pos[cc]=pos[size];
105 }
106
107
108 #ifdef salka
109 set(91,47,-1,1);
110 set(108,44,-1,1);
111 set(103,64,-1,1);
112 set(96,89,-1,1);
113 srand(4336734);
114 #endif
115 #ifdef veronika
116 set(58,31,-1,1);
117 set(106,34,-1,1);
118 srand(1223857631);
119 #endif
120 #ifdef kelly
121 set(30,22,-1,1);
122 set(75,22,-1,1);
123 srand(4431287269);
124 #endif
125 #ifdef dad
126 set(10,2,-1,1);
127 set(10,3,-1,1);
128 set(10,4,-1,1);
129 set(2,15,-1,1);
130 set(12,16,-1,1);
131 set(10,7,-1,1);
132 set(13,9,-1,1);
133 set(8,9,-1,1);
134 #endif
135 #ifdef liss
136 set(2,8,-1,1);
137 set(7,3,-1,1);
138 set(11,4,-1,1);
139 set(13,7,-1,1);
140 set(15,10,-1,1);
141 #endif
142 #ifdef stephanie
143 set(12,11,-1,1);
144 set(15,11,-1,1);
145 set(14,16,-1,1);
146 #endif
147 #ifdef moot
148 set(30,20,-1,1);
149 set(25,25,-1,1);
150 set(26,31,-1,1);
151 set(12,27,-1,1);
152 set(35,23,-1,1);
153 set(13,12,-1,1);
154 set(20,4,-1,1);
155 set(32,7,-1,1);
156 #endif
157 #ifdef lovely1
158 set(20,4,-1,1);
159 set(24,3,-1,1);
160 set(22,8,-1,1);
161 set(11,28,-1,1);
162 #endif
163 #ifdef cyclone
164 set(10,4,-1,1);
165 set(10,5,-1,1);
166 set(6,7,-1,1);
167 set(2,12,-1,1);
168 #endif
169 #ifdef girl3
170 set(16,6,-1,1);
171 set(32,5,-1,1);
172 set(22,11,-1,1);
173 #endif
174
175 #ifdef antique
176 set(10,5,-1,-1);
177 set(11,5,-1,-1);
178 set(10,6,-1,-1);
179 set(11,6,-1,-1);
180 set(11,7,-1,-1);
181 {
182 int i;
183 for (i=0;i<16;i++) {
184 set(i,0,-1,-1);
185 set(i,15,-1,-1);
186 set(i,14,-1,-1);
187 }
188 for (i=1;i<14;i++) {
189 set(0,i,-1,-1);
190 set(15,i,-1,-1);
191 }
192 }
193
194 set(9,5,-1,1);
195 set(12,5,-1,1);
196 set(9,10,-1,1);
197 set(11,10,-1,1);
198 set(9,7,-1,1);
199
200 #endif
201 #ifdef benflag
202 set(1,1,-1,1);
203 set(5,1,-1,1);
204 set(1,3,-1,1);
205 set(5,3,-1,1);
206 #endif
207 #ifdef qi
208 set(7,6,-1,1);
209 set(7,11,-1,1);
210 set(3,6,-1,1);
211 set(11,10,-1,1);
212 set(7,14,-1,1);
213
214 /*now for blank out */
215 set(7,3,-1,-1);
216 set(7,4,-1,-1);
217 set(8,3,-1,-1);
218 set(8,4,-1,-1);
219 #endif
220
221 while (size) {
222 int c,d,e;
223 c = (rand()>>1) % (size);
224 d = pos[c];
225 x = d % width;
226 y = d / width;
227 if (there[x][y]) {
228 fprintf(stderr,"no %d %d %d %d\n as %d",c,d,x,y,there[x][y]);
229 int i;
230 for (i=0;i<size;i++) {
231 int x,y;
232 int d;
233 d = pos[c];
234 x = d % width;
235 y = d / width;
236 fprintf(stderr,"i %d posi %d x %d y %d there %d\n",i,pos[i],x,y,there[x][y]);
237 }
238 exit(1);
239 }
240 if ( (x && ((e=there[x-1][y])>0)) ||
241 ((x<width-1)&&((e=there[x+1][y])>0)) ||
242 ((y<height-1)&&((e=there[x][y+1])>0)) ||
243 ((y)&&((e=there[x][y-1])>0)) ) {
244 e++;
245 set(x,y,c,e);
246 }
247 }
248
249
250 #ifdef qi
251
252 /*now for blank out */
253 int e=20;
254 printf("%010d|%d|%d\n",e,7,3);
255 printf("%010d|%d|%d\n",e,7,4);
256 printf("%010d|%d|%d\n",e,8,3);
257 printf("%010d|%d|%d\n",e,8,4);
258 #endif
259
260 return 0;
261 }
262
263 int main()
264 {
265 points();
266 }

  ViewVC Help
Powered by ViewVC 1.1.5