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

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Thu Jun 23 05:07:56 2011 UTC (7 years, 1 month ago) by hib
Branch: MAIN
Changes since 1.3: +13 -2 lines
File MIME type: text/plain
adding stuff - ben ,arissa partially done.  Havent started stephanie.
Kelly and vikroia are shipped - did a demo of edition 2 of enlightenment
and building first version of japan
.
1 hib 1.1 #include <stdio.h>
2 hib 1.4 #define liss
3 hib 1.1
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 hib 1.2 #ifdef kelly
16     #define WIDTH 144
17     #define HEIGHT 48
18     #endif
19    
20 hib 1.3 #ifdef dad
21     #define WIDTH 18
22     #define HEIGHT 25
23     #endif
24    
25 hib 1.4 #ifdef liss
26     #define WIDTH 28
27     #define HEIGHT 21
28     #endif
29    
30 hib 1.1 int there[WIDTH][HEIGHT];
31     int there2[WIDTH][HEIGHT];
32     int *pos;
33    
34     int points (){
35     int width=WIDTH;
36     int height=HEIGHT;
37     int x,y;
38     int size;
39     pos = (int *) there2;
40     for (x=0;x<width;x++) {
41     for (y=0;y<height;y++) {
42     there[x][y] = 0;
43     pos[y*width+x] = y*width+x;
44     }
45     }
46     size=width*height;
47    
48     #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];}
49    
50    
51     #ifdef salka
52     set(91,47,-1,1);
53     set(108,44,-1,1);
54     set(103,64,-1,1);
55     set(96,89,-1,1);
56     srand(4336734);
57     #endif
58     #ifdef veronika
59     set(58,31,-1,1);
60     set(106,34,-1,1);
61     srand(1223857631);
62     #endif
63 hib 1.2 #ifdef kelly
64     set(30,22,-1,1);
65     set(75,22,-1,1);
66     srand(4431287269);
67     #endif
68 hib 1.3 #ifdef dad
69     set(10,2,-1,1);
70     set(10,3,-1,1);
71     set(10,4,-1,1);
72     set(2,15,-1,1);
73     set(12,16,-1,1);
74     set(10,7,-1,1);
75     set(13,9,-1,1);
76     set(8,9,-1,1);
77     #endif
78 hib 1.4 #ifdef liss
79     set(2,8,-1,1);
80     set(7,3,-1,1);
81     set(11,4,-1,1);
82     set(13,7,-1,1);
83     set(15,10,-1,1);
84     #endif
85 hib 1.1
86     while (size) {
87     int c,d,e;
88     c = (rand()>>1) % (size);
89     d = pos[c];
90     x = d % width;
91     y = d / width;
92     if (there[x][y]) {
93     fprintf(stderr,"no %d %d %d %d\n",c,d,x,y);
94     exit(1);
95     }
96     if ( (x && (e=there[x-1][y])) ||
97     ((x<width-1)&&(e=there[x+1][y])) ||
98     ((y<height-1)&&(e=there[x][y+1])) ||
99     ((y)&&(e=there[x][y-1])) ) {
100     e++;
101     set(x,y,c,e);
102     }
103     }
104     return 0;
105     }
106    
107     int main()
108     {
109     points();
110     }

  ViewVC Help
Powered by ViewVC 1.1.5