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

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Sat Oct 8 22:06:17 2011 UTC (6 years, 10 months ago) by hib
Branch: MAIN
Changes since 1.4: +29 -1 lines
File MIME type: text/plain
working on tilify.c - this will be pretty neat
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #define moot
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 int there[WIDTH][HEIGHT];
44 int there2[WIDTH][HEIGHT];
45 int *pos;
46
47 int points (){
48 int width=WIDTH;
49 int height=HEIGHT;
50 int x,y;
51 int size;
52 pos = (int *) there2;
53 for (x=0;x<width;x++) {
54 for (y=0;y<height;y++) {
55 there[x][y] = 0;
56 pos[y*width+x] = y*width+x;
57 }
58 }
59 size=width*height;
60
61 #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];}
62
63
64 #ifdef salka
65 set(91,47,-1,1);
66 set(108,44,-1,1);
67 set(103,64,-1,1);
68 set(96,89,-1,1);
69 srand(4336734);
70 #endif
71 #ifdef veronika
72 set(58,31,-1,1);
73 set(106,34,-1,1);
74 srand(1223857631);
75 #endif
76 #ifdef kelly
77 set(30,22,-1,1);
78 set(75,22,-1,1);
79 srand(4431287269);
80 #endif
81 #ifdef dad
82 set(10,2,-1,1);
83 set(10,3,-1,1);
84 set(10,4,-1,1);
85 set(2,15,-1,1);
86 set(12,16,-1,1);
87 set(10,7,-1,1);
88 set(13,9,-1,1);
89 set(8,9,-1,1);
90 #endif
91 #ifdef liss
92 set(2,8,-1,1);
93 set(7,3,-1,1);
94 set(11,4,-1,1);
95 set(13,7,-1,1);
96 set(15,10,-1,1);
97 #endif
98 #ifdef stephanie
99 set(12,11,-1,1);
100 set(15,11,-1,1);
101 set(14,16,-1,1);
102 #endif
103 #ifdef moot
104 set(30,20,-1,1);
105 set(25,25,-1,1);
106 set(26,31,-1,1);
107 set(12,27,-1,1);
108 set(35,23,-1,1);
109 set(13,12,-1,1);
110 set(20,4,-1,1);
111 set(32,7,-1,1);
112 #endif
113
114 while (size) {
115 int c,d,e;
116 c = (rand()>>1) % (size);
117 d = pos[c];
118 x = d % width;
119 y = d / width;
120 if (there[x][y]) {
121 fprintf(stderr,"no %d %d %d %d\n",c,d,x,y);
122 exit(1);
123 }
124 if ( (x && (e=there[x-1][y])) ||
125 ((x<width-1)&&(e=there[x+1][y])) ||
126 ((y<height-1)&&(e=there[x][y+1])) ||
127 ((y)&&(e=there[x][y-1])) ) {
128 e++;
129 set(x,y,c,e);
130 }
131 }
132 return 0;
133 }
134
135 int main()
136 {
137 points();
138 }

  ViewVC Help
Powered by ViewVC 1.1.5