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

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Fri Mar 18 11:49:48 2011 UTC (7 years, 8 months ago) by hib
Branch: MAIN
Changes since 1.1: +11 -1 lines
File MIME type: text/plain
cool
1 #include <stdio.h>
2 #define kelly
3
4
5 #ifdef salka
6 #define WIDTH 132
7 #define HEIGHT 136
8 #endif
9
10 #ifdef veronika
11 #define WIDTH 144
12 #define HEIGHT 48
13 #endif
14
15 #ifdef kelly
16 #define WIDTH 144
17 #define HEIGHT 48
18 #endif
19
20 int there[WIDTH][HEIGHT];
21 int there2[WIDTH][HEIGHT];
22 int *pos;
23
24 int points (){
25 int width=WIDTH;
26 int height=HEIGHT;
27 int x,y;
28 int size;
29 pos = (int *) there2;
30 for (x=0;x<width;x++) {
31 for (y=0;y<height;y++) {
32 there[x][y] = 0;
33 pos[y*width+x] = y*width+x;
34 }
35 }
36 size=width*height;
37
38 #define set(x,y,c,e) {there[x][y]=e;int cc;cc=(c);if (cc==-1) cc=y*width+x;printf("%010d|%d|%d\n",e,x,y);size=size-1;pos[cc]=pos[size];}
39
40
41 #ifdef salka
42 set(91,47,-1,1);
43 set(108,44,-1,1);
44 set(103,64,-1,1);
45 set(96,89,-1,1);
46 srand(4336734);
47 #endif
48 #ifdef veronika
49 set(58,31,-1,1);
50 set(106,34,-1,1);
51 srand(1223857631);
52 #endif
53 #ifdef kelly
54 set(30,22,-1,1);
55 set(75,22,-1,1);
56 srand(4431287269);
57 #endif
58
59 while (size) {
60 int c,d,e;
61 c = (rand()>>1) % (size);
62 d = pos[c];
63 x = d % width;
64 y = d / width;
65 if (there[x][y]) {
66 fprintf(stderr,"no %d %d %d %d\n",c,d,x,y);
67 exit(1);
68 }
69 if ( (x && (e=there[x-1][y])) ||
70 ((x<width-1)&&(e=there[x+1][y])) ||
71 ((y<height-1)&&(e=there[x][y+1])) ||
72 ((y)&&(e=there[x][y-1])) ) {
73 e++;
74 set(x,y,c,e);
75 }
76 }
77 return 0;
78 }
79
80 int main()
81 {
82 points();
83 }

  ViewVC Help
Powered by ViewVC 1.1.5