--- xlib_bw_120x80.c	2026-01-13 22:14:56.733931548 +0100
+++ xlib_bw_120x80w2.c	2026-01-23 03:46:18.767236471 +0100
@@ -7,94 +7,12 @@
 #include <string.h>
 #include <time.h>
 
-#define W 100
-#define H 80
+#define W 130
+#define H 90
 #define FPS 3
 
 unsigned char img[W * H];
-
-char map[] =
-"1111111111111111111111111111111111111111111000000000000000000000011111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111000000000000000000000011111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111000000000000000000000011111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111100000000000111111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111110000000001111111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111111000000011111111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111111100011111111111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000"
-"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000"
-"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000"
-"1111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000"
-"1111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000"
-"1111111111111111111111111111111110011111111111111111111111111111111111111111111100000000000000000000"
-"1111111111111111111111111111111110000000000011111111111111111111111111111100000000000000000000000000"
-"1111111111111111111111111111111110000000000001111111111111111111111111111000000000000000000000000000"
-"1111111111111111111111111111111100000000000000111111111111111111111111000000000000000000000000000000"
-"1111111111111111111111111111111000000000000000011111111111111111111111000000000000000000000000000000"
-"1111111111111111001111111111111000000000111111111111111111111111111111000000000000000000011000000011"
-"1111111111111110000111111111111000000001111111111111111111111111111111000000000000000000111000011111"
-"1111111110000000000011111111111000000011111111111111111111111111111111000000000000000001111000011111"
-"1111111110000000000001111111111000000111111111111111111111111111111111100000000000000011111000011111"
-"1111111110000000000000111111111000001111111111111111111111111111111111110000000000000111111000011111"
-"1111111110000000000000011111111000011111111111111111111111111111111111111000000000001111111000011111"
-"1111111110000000000000011111111111111111111111111111111111111111111111111100000000011111111000011111"
-"1111111110000000000000011111111111111111111111111111111111111111111111111110000000111111111000001111"
-"1111111110000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111"
-"1111111110000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111"
-"1111111110000000000000011111111000000000111111111111111111111111111111111111100011111111111111111111"
-"1111111110000000000000011111111000000000000000111111111111111111111111111111100001111111111111111111"
-"1111111110000000000000011111111000000000000000111111111111111111111111111111100000111111111111111111"
-"1111111110000000000000111111111000000000000000111111111111111111111111111111000000011111111111000011"
-"1111111110000000000001111111111000000000000000111111111111111111111111111110000000001111111000000000"
-"1111111111000000000011111111111000000000000001111111111111111111111111111100000000000000000000000000"
-"1111111111100000000111111111111000000000000011111111111111111111111111111000000000000000000000000000"
-"1111111111110000001111111111111000000000000111111111111111111111111111110000000000000000000000000000"
-"1111111111111000001111111111110000000000001111111111111111111111111111100000000000000000000000000000"
-"1111111111111000001111111111100000000000011111111111111111111111111111000000000000000000000000000000"
-"1111111111111000001111111111000000000000111111111111111111111111111110000000000000000000000000000000"
-"1111111111111000001111111110000000000011111111111111111111111111111100000000000000000000000000000000"
-"1111111111111000000111111100000000000011111111111111111111111111111100000000000000000001110000000000"
-"1111111111111000000011111100000000000111111111111111111111111111111111000000000000000011111000000000"
-"1111111111111000000001111100000000000111111111111111111111111111111111100000000000000111111000000000"
-"1111111111111000000000111100000000000111111111111111111111111111111111110000000000001111111000000000"
-"1111111111111000000000011100000000000111111111111111111111111111111111111000000000011111111000000000"
-"1111111111111000000000001100000000000111111111111110011111111111111111111100000000111111111000000000"
-"1111111111111000000000000100000000000111111111111100001111111111111111111110000001111111111000000000"
-"1111111111111000000000000000000000000111111111111000000000000001111111111111000011111111111100000000"
-"1111111111111000000000000000000000001111111111110000000000000001111111111111111111111111111110000000"
-"1111111111111110000000000000000000011111111111110000000000000011111111111111111111111111111110000000"
-"1111111111111111000000000000000000111111111111111000000000000111111111111111111111111111111110000000"
-"1111111111111111111111111111110001111111111111111100000000001111111111111111111111111111111110000000"
-"1111111111111111111111111111111011111111111111111110000000011111111111111111111000000111111110000000"
-"1111111111111111111111111111111111111111111111111110000000111111111111111111111000000011111110000000"
-"1111111111111111111111111111111111111111111111111110000000111111111111111111110000000001111111000000"
-"1111111111111111111111111111111111111111111111000000000000011111111111111111100000000000000111100011"
-"1111111111111111111111111111111111111111111110000000000000001111111111111111000000000000000111110111"
-"1111111111111111111111111111111111100000000000000000000000000111111111111110000000000000000111111111"
-"1111111111111111111111111111111111100000000000000000000000000011111111111100000000000000000111111111"
-"1111111111111111111111111111111111110000000000000000000000000001111111111100000000000000001111111111"
-"1111111111111111111111111111111111111000000000000000000000000000000011111100000000000000011111111111"
-"1111111111111111111111111111111111111000000000000000000000000000000001111100000000000000111111111111"
-"1111111111111111111111111111111111111000000000000000000000000000000000000000000000000001111111111111"
-"1111111111111111111111111111111111111000000000000000000000011110000000000000000000000011111111111111"
-"1111111111111111111111111111111111111000000000000000000000111110000000000000000000000011111111111111"
-"1111111111111111111111111111111111110000000000000000000001111110000000000000000000000011111111111111"
-"1111111111111000000011111111111111100000000000000000000011111110000000000000000000000001111111111111"
-"1111111111110000000001111111111111100000000000000000000111111110000000000000000000000000111111111111"
-"1111111111100000000000011111111111100000000000000011111111111110000000000000000000000000011111111111"
-"1111111111100000000000001111111111100000000000000111111111111111000000000000000000000000001111111111"
-"1111111111100000000000000111111111100000000000000111111111111111000000000000000000000000000111111111"
-"1111111111100000000000000011111111100000000000000111111111111111000000000000000000000000000011111111"
-"1111111111100000000000000011111111100000000000001111111111111111000000000000000000000000000001111111"
-"1111111111100000000000000011111111100000000000011111111111111111000000000000000000000000000001111111"
-"1111111111100000000000000011111111110000000000111111111111111111000000000000000000000000000001111111"
-"1111111111100000000000000011111111111000000001111111111111111110000000000000000000000000000001111111"
-"0000000000000000000000000011111111111100000011111111111111111100000000000000000000000000000001111111"
-"0000000000000000000000000111111111111110000111111111111111111100000000000000000000000000000001111111"
-"0000000000000000000000001111111111111111111111111111111111111110000000000000000000000000000001111111"
-"0000000000000000000000011111111111111111111111111111111111111110000000000000000000000000000001111111"
-"0000000000000000000000011111111111111111111111111111111111111110000000000000000000000000000001111111"
-;
+char map[W * H];
 
 enum _dir {
   RIGHT,
@@ -111,14 +29,7 @@
   int dy;
 };
 
-struct _elem elems[] = {
-  { 10, 10, RIGHT,  -1, -1 },
-  { 20, 15, BOTTOM, -1, -1 },
-  { 15,  5, LEFT,   -1, -1 },
-  { 15, 20, TOP,    -1, -1 },
-  { 35, 30, RIGHT,  -1, -1 },
-  { 55, 50, BOTTOM, -1, -1 },
-};
+struct _elem elems[10];
 
 struct _controler {
   unsigned int x;
@@ -127,9 +38,16 @@
 };
 
 struct _controler controlers[] = {
-  { 105,  4, "d" },
-  { 105, 20, "c" },
-  { 105, 36, "p" },
+  { W+5,  4, "d" },
+  { W+5, 20, "c" },
+  { W+5, 36, "p" },
+};
+
+struct _plot {
+  int x;
+  int y;
+  int v;
+  int d;
 };
 
 struct _clb { // collectible
@@ -145,6 +63,8 @@
   { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
   { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
   { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
+  { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
+  { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
 };
 
 struct _clic {
@@ -260,6 +180,51 @@
 }
 
 void
+init_elems()
+{
+  for (int e = 0; e < sizeof(elems) / sizeof(struct _elem); e++) {
+    struct _elem *elm = &elems[e];
+    elm->dx = -1;
+    elm->dy = -1;
+    elm->x = rand() % (W-1);
+    elm->y = rand() % (H-1);
+    elm->dir = rand() % (4);
+  }
+}
+
+void
+init_map()
+{
+  struct _plot plots[110];
+  for (int d = 0; d < 110; d++) {
+    struct _plot *plt = &plots[d];
+    int x = rand() % (W);
+    int y = rand() % (H);
+    int v = rand() % (2);
+    plt->x = x;
+    plt->y = y;
+    plt->v = v;
+    plt->d = 0;
+  }
+  for (int y = 0; y < H; y++) {
+    for (int x = 0; x < W; x++) {
+      struct _plot *plt0 = &plots[0];
+      struct _plot *plt = &plots[0];
+      int d1 = mana_dist(x, y, plt0->x, plt0->y);
+      for (int d = 1; d < 110; d++) {
+        struct _plot *pltn = &plots[d];
+        int d2 = mana_dist(x, y, pltn->x, pltn->y);
+        if (d2 < d1) {
+          plt = &plots[d];
+          d1 = d2;
+        }
+      }
+      map[y * W + x] = (plt->v ? '0' : '1');
+    }
+  }
+}
+
+void
 dir_move(struct _elem *elm)
 {
   switch (elm->dir) {
@@ -375,7 +340,7 @@
 {
   for (int d = 0; d < sizeof(elems) / sizeof(struct _elem); d++) {
     struct _elem *elm = &elems[d];
-    printf("# %2d: %2d, %2d ; %d ", d, elm->x, elm->y, elm->dir);
+    printf("# %2d: %3d, %3d ; %d ", d, elm->x, elm->y, elm->dir);
     printf("; %2d, %2d\n", elm->dx, elm->dy);
   }
   printf("\n");
@@ -412,14 +377,16 @@
     return 1;
   }
 
+  srand(time(NULL));
+  init_map();
+  init_elems();
+
   for (int y = 0; y < H; y++) {
     for (int x = 0; x < W; x++) {
       img[y * W + x] = (map[y * W + x] == '1' ? 1 : 0);
     }
   }
 
-  srand(time(NULL));
-
   int screen = DefaultScreen(dpy);
   Window win = XCreateSimpleWindow(
     dpy,
@@ -439,15 +406,15 @@
     ButtonReleaseMask |
     PointerMotionMask);
 
-  XStoreName(dpy, win, "120x80 BW");
+  XStoreName(dpy, win, "140x90 BW");
 
   XSizeHints hints;
   hints.flags = PMinSize | PMaxSize;
 
-  hints.min_width  = 120;
-  hints.min_height = 80;
-  hints.max_width  = 120;
-  hints.max_height = 80;
+  hints.min_width  = W+20;
+  hints.min_height = H;
+  hints.max_width  = W+20;
+  hints.max_height = H;
 
   XSetWMNormalHints(dpy, win, &hints);
 
@@ -542,7 +509,7 @@
     draw_collectibles(dpy, win, gc, black, white);
 
     XSetForeground(dpy, gc, black);
-    XDrawLine(dpy, win, gc, 100, 0, 100, H);
+    XDrawLine(dpy, win, gc, W, 0, W, H);
 
     /* For each Controler */
     for (int d = 0; d < sizeof(controlers) / sizeof(struct _controler); d++) {
