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

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Wed Dec 26 18:40:23 2012 UTC (5 years, 4 months ago) by hib
Branch: MAIN
Changes since 1.7: +7 -7 lines
File MIME type: text/plain
working on cyclone
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #define cyclone
5
6
7 #ifdef salka
8 #define WIDTH 132
9 #define HEIGHT 136
10 #endif
11
12 #ifdef veronika
13 #define WIDTH 144
14 #define HEIGHT 48
15 #endif
16
17 #ifdef kelly
18 #define WIDTH 144
19 #define HEIGHT 48
20 #endif
21
22 #ifdef dad
23 #define WIDTH 18
24 #define HEIGHT 25
25 #endif
26
27 #ifdef liss
28 #define WIDTH 28
29 #define HEIGHT 21
30 #endif
31
32 #ifdef stephanie
33 #define WIDTH 32
34 #define HEIGHT 24
35 #endif
36
37
38 #ifdef moot
39 #define WIDTH 64
40 #define HEIGHT 50
41 #endif
42
43 #ifdef lovely1
44 #define WIDTH 32
45 #define HEIGHT 42
46 #endif
47
48 #ifdef cyclone
49 #define WIDTH 16
50 #define HEIGHT 16
51 #endif
52
53 #ifdef girl3
54 #define WIDTH 144
55 #define HEIGHT 48
56 #endif
57
58 int there[WIDTH][HEIGHT];
59 int there2[WIDTH][HEIGHT];
60 int *pos;
61
62 int points (){
63 int width=WIDTH;
64 int height=HEIGHT;
65 int x,y;
66 int size;
67 pos = (int *) there2;
68 for (x=0;x<width;x++) {
69 for (y=0;y<height;y++) {
70 there[x][y] = 0;
71 pos[y*width+x] = y*width+x;
72 }
73 }
74 size=width*height;
75
76 #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];}
77
78
79 #ifdef salka
80 set(91,47,-1,1);
81 set(108,44,-1,1);
82 set(103,64,-1,1);
83 set(96,89,-1,1);
84 srand(4336734);
85 #endif
86 #ifdef veronika
87 set(58,31,-1,1);
88 set(106,34,-1,1);
89 srand(1223857631);
90 #endif
91 #ifdef kelly
92 set(30,22,-1,1);
93 set(75,22,-1,1);
94 srand(4431287269);
95 #endif
96 #ifdef dad
97 set(10,2,-1,1);
98 set(10,3,-1,1);
99 set(10,4,-1,1);
100 set(2,15,-1,1);
101 set(12,16,-1,1);
102 set(10,7,-1,1);
103 set(13,9,-1,1);
104 set(8,9,-1,1);
105 #endif
106 #ifdef liss
107 set(2,8,-1,1);
108 set(7,3,-1,1);
109 set(11,4,-1,1);
110 set(13,7,-1,1);
111 set(15,10,-1,1);
112 #endif
113 #ifdef stephanie
114 set(12,11,-1,1);
115 set(15,11,-1,1);
116 set(14,16,-1,1);
117 #endif
118 #ifdef moot
119 set(30,20,-1,1);
120 set(25,25,-1,1);
121 set(26,31,-1,1);
122 set(12,27,-1,1);
123 set(35,23,-1,1);
124 set(13,12,-1,1);
125 set(20,4,-1,1);
126 set(32,7,-1,1);
127 #endif
128 #ifdef lovely1
129 set(20,4,-1,1);
130 set(24,3,-1,1);
131 set(22,8,-1,1);
132 set(11,28,-1,1);
133 #endif
134 #ifdef cyclone
135 set(10,4,-1,1);
136 set(10,5,-1,1);
137 set(6,7,-1,1);
138 set(2,12,-1,1);
139 #endif
140 #ifdef girl3
141 set(16,6,-1,1);
142 set(32,5,-1,1);
143 set(22,11,-1,1);
144 #endif
145
146 while (size) {
147 int c,d,e;
148 c = (rand()>>1) % (size);
149 d = pos[c];
150 x = d % width;
151 y = d / width;
152 if (there[x][y]) {
153 fprintf(stderr,"no %d %d %d %d\n",c,d,x,y);
154 exit(1);
155 }
156 if ( (x && (e=there[x-1][y])) ||
157 ((x<width-1)&&(e=there[x+1][y])) ||
158 ((y<height-1)&&(e=there[x][y+1])) ||
159 ((y)&&(e=there[x][y-1])) ) {
160 e++;
161 set(x,y,c,e);
162 }
163 }
164 return 0;
165 }
166
167 int main()
168 {
169 points();
170 }

  ViewVC Help
Powered by ViewVC 1.1.5