ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-5.01.tar.gz
[xscreensaver] / hacks / petri.c
1 /* petri, simulate mold in a petri dish. v2.7
2  * by Dan Bornstein, danfuzz@milk.com
3  * with help from Jamie Zawinski, jwz@jwz.org
4  * Copyright (c) 1992-1999 Dan Bornstein.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and its
7  * documentation for any purpose is hereby granted without fee, provided that
8  * the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation.  No representations are made about the suitability of this
11  * software for any purpose.  It is provided "as is" without express or 
12  * implied warranty.
13  *
14  *
15  * Brief description of options/resources:
16  *
17  * delay: the delay in microseconds between iterations
18  * size: the size of a cell in pixels
19  * count: the number of different kinds of mold (minimum: 2)
20  * diaglim: the age limit for diagonal growth as a multiplier of orthogonal
21  *   growth (minimum: 1, maximum 2). 1 means square growth, 1.414 
22  *   (i.e., sqrt(2)) means approximately circular growth, 2 means diamond
23  *   growth.
24  * anychan: the chance (fraction, between 0 and 1) that at each iteration,
25  *   any new cell will be born
26  * minorchan: the chance (fraction, between 0 and 1) that, given that new
27  *   cells will be added, that only two will be added (a minor cell birth
28  *   event)
29  * instantdeathchan: the chance (fraction, between 0 and 1) that, given
30  *   that death and destruction will happen, that instead of using plague
31  *   cells, death will be instantaneous
32  * minlifespan: the minimum lifespan of a colony (before black death ensues)
33  * maxlifespan: the maximum lifespan of a colony (before black death ensues)
34  * minlifespeed: the minimum speed for living cells as a fraction of the
35  *   maximum possible speed (fraction, between 0 and 1)
36  * maxlifespeed: the maximum speed for living cells as a fraction of the
37  *   maximum possible speed (fraction, between 0 and 1)
38  * mindeathspeed: the minimum speed for black death cells as a fraction of the
39  *   maximum possible speed (fraction, between 0 and 1)
40  * maxdeathspeed: the maximum speed for black death cells as a fraction of the
41  *   maximum possible speed (fraction, between 0 and 1)
42  * originalcolors: if true, count must be 8 or less and the colors are a 
43  *   fixed set of primary and secondary colors (the artist's original choices)
44  *
45  * Interesting settings:
46  *
47  *      petri -originalcolors -size 8
48  *      petri -size 2
49  *      petri -size 8 -diaglim 1.8
50  *      petri -diaglim 1.1
51  *
52  *      petri -count 4 -anychan 0.01 -minorchan 1 \
53  *              -minlifespan 2000 -maxlifespan 5000
54  *
55  *      petri -count 3 -anychan 1 -minlifespan 100000 \ 
56  *              -instantdeathchan 0
57  *
58  *      petri -minlifespeed 0.02 -maxlifespeed 0.03 -minlifespan 1 \
59  *              -maxlifespan 1 -instantdeathchan 0 -minorchan 0 \
60  *              -anychan 0.3 -delay 4000
61  */
62
63 #include <math.h>
64 #include "screenhack.h"
65 #include "spline.h"
66
67 #define FLOAT float
68 #define RAND_FLOAT (((FLOAT) (random() & 0xffff)) / ((FLOAT) 0x10000))
69
70 typedef struct cell_s 
71 {
72     unsigned char col;              /*  0      */
73     unsigned char isnext;           /*  1      */
74     unsigned char nextcol;          /*  2      */
75                                     /*  3      */
76     struct cell_s *next;            /*  4      */
77     struct cell_s *prev;            /*  8    - */
78     FLOAT speed;                    /* 12      */
79     FLOAT growth;                   /* 16 20 - */
80     FLOAT nextspeed;                /* 20 28   */
81                                     /* 24 36 - */
82 } cell;
83
84 struct state {
85   Display *dpy;
86   Window window;
87
88   int arr_width;
89   int arr_height;
90   int count;
91
92   cell *arr;
93   cell *head;
94   cell *tail;
95   int blastcount;
96
97   GC *coloredGCs;
98
99   int windowWidth;
100   int windowHeight;
101   int xOffset;
102   int yOffset;
103   int xSize;
104   int ySize;
105
106   FLOAT orthlim;
107   FLOAT diaglim;
108   FLOAT anychan;
109   FLOAT minorchan;
110   FLOAT instantdeathchan;
111   int minlifespan;
112   int maxlifespan;
113   FLOAT minlifespeed;
114   FLOAT maxlifespeed;
115   FLOAT mindeathspeed;
116   FLOAT maxdeathspeed;
117   Bool originalcolors;
118
119   int warned;
120   int delay;
121 };
122
123
124 #define cell_x(c) (st->arr_width ? ((c) - st->arr) % st->arr_width : 0)
125 #define cell_y(c) (st->arr_width ? ((c) - st->arr) / st->arr_width : 0)
126
127
128 static int random_life_value (struct state *st)
129 {
130     return (int) ((RAND_FLOAT * (st->maxlifespan - st->minlifespan)) + st->minlifespan);
131 }
132
133 static void setup_random_colormap (struct state *st, XWindowAttributes *xgwa)
134 {
135     XGCValues gcv;
136     int lose = 0;
137     int ncolors = st->count - 1;
138     int n;
139     XColor *colors = (XColor *) calloc (sizeof(*colors), st->count*2);
140     
141     colors[0].pixel = get_pixel_resource (st->dpy, xgwa->colormap,
142                                           "background", "Background");
143     
144     make_random_colormap (st->dpy, xgwa->visual, xgwa->colormap,
145                           colors+1, &ncolors, True, True, 0, True);
146     if (ncolors < 1)
147       {
148         fprintf (stderr, "%s: couldn't allocate any colors\n", progname);
149         exit (-1);
150       }
151     
152     ncolors++;
153     st->count = ncolors;
154     
155     memcpy (colors + st->count, colors, st->count * sizeof(*colors));
156     colors[st->count].pixel = get_pixel_resource (st->dpy, xgwa->colormap,
157                                               "foreground", "Foreground");
158     
159     for (n = 1; n < st->count; n++)
160     {
161         int m = n + st->count;
162         colors[n].red = colors[m].red / 2;
163         colors[n].green = colors[m].green / 2;
164         colors[n].blue = colors[m].blue / 2;
165         
166         if (!XAllocColor (st->dpy, xgwa->colormap, &colors[n]))
167         {
168             lose++;
169             colors[n] = colors[m];
170         }
171     }
172
173     if (lose)
174     {
175         fprintf (stderr, 
176                  "%s: unable to allocate %d half-intensity colors.\n",
177                  progname, lose);
178     }
179     
180     for (n = 0; n < st->count*2; n++) 
181     {
182         gcv.foreground = colors[n].pixel;
183         st->coloredGCs[n] = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
184     }
185
186     free (colors);
187 }
188
189 static void setup_original_colormap (struct state *st, XWindowAttributes *xgwa)
190 {
191     XGCValues gcv;
192     int lose = 0;
193     int n;
194     XColor *colors = (XColor *) calloc (sizeof(*colors), st->count*2);
195     
196     colors[0].pixel = get_pixel_resource (st->dpy, xgwa->colormap,
197                                           "background", "Background");
198
199     colors[st->count].pixel = get_pixel_resource (st->dpy, xgwa->colormap,
200                                               "foreground", "Foreground");
201
202     for (n = 1; n < st->count; n++)
203     {
204         int m = n + st->count;
205         colors[n].red =   ((n & 0x01) != 0) * 0x8000;
206         colors[n].green = ((n & 0x02) != 0) * 0x8000;
207         colors[n].blue =  ((n & 0x04) != 0) * 0x8000;
208
209         if (!XAllocColor (st->dpy, xgwa->colormap, &colors[n]))
210         {
211             lose++;
212             colors[n] = colors[0];
213         }
214
215         colors[m].red   = colors[n].red + 0x4000;
216         colors[m].green = colors[n].green + 0x4000;
217         colors[m].blue  = colors[n].blue + 0x4000;
218
219         if (!XAllocColor (st->dpy, xgwa->colormap, &colors[m]))
220         {
221             lose++;
222             colors[m] = colors[st->count];
223         }
224     }
225
226     if (lose)
227     {
228         fprintf (stderr, 
229                  "%s: unable to allocate %d colors.\n",
230                  progname, lose);
231     }
232     
233     for (n = 0; n < st->count*2; n++) 
234     {
235         gcv.foreground = colors[n].pixel;
236         st->coloredGCs[n] = XCreateGC (st->dpy, st->window, GCForeground, &gcv);
237     }
238
239     free (colors);
240 }
241
242 static void
243 setup_display (struct state *st)
244 {
245     XWindowAttributes xgwa;
246     Colormap cmap;
247
248     int cell_size = get_integer_resource (st->dpy, "size", "Integer");
249     int osize, alloc_size, oalloc;
250     int mem_throttle = 0;
251     char *s;
252
253     if (cell_size < 1) cell_size = 1;
254
255     osize = cell_size;
256
257     s = get_string_resource (st->dpy, "memThrottle", "MemThrottle");
258     if (s)
259       {
260         int n;
261         char c;
262         if (1 == sscanf (s, " %d M %c", &n, &c) ||
263             1 == sscanf (s, " %d m %c", &n, &c))
264           mem_throttle = n * (1 << 20);
265         else if (1 == sscanf (s, " %d K %c", &n, &c) ||
266                  1 == sscanf (s, " %d k %c", &n, &c))
267           mem_throttle = n * (1 << 10);
268         else if (1 == sscanf (s, " %d %c", &n, &c))
269           mem_throttle = n;
270         else
271           {
272             fprintf (stderr, "%s: invalid memThrottle \"%s\" (try \"10M\")\n",
273                      progname, s);
274             exit (1);
275           }
276         
277         free (s);
278       }
279
280     XGetWindowAttributes (st->dpy, st->window, &xgwa);
281
282     st->originalcolors = get_boolean_resource (st->dpy, "originalcolors", "Boolean");
283
284     st->count = get_integer_resource (st->dpy, "count", "Integer");
285     if (st->count < 2) st->count = 2;
286
287     /* number of colors can't be greater than the half depth of the screen. */
288     if (st->count > (unsigned int) (1L << (xgwa.depth-1)))
289       st->count = (unsigned int) (1L << (xgwa.depth-1));
290
291     /* Actually, since cell->col is of type char, this has to be small. */
292     if (st->count >= (unsigned int) (1L << ((sizeof(st->arr[0].col) * 8) - 1)))
293       st->count = (unsigned int) (1L << ((sizeof(st->arr[0].col) * 8) - 1));
294
295
296     if (st->originalcolors && (st->count > 8))
297     {
298         st->count = 8;
299     }
300
301     st->coloredGCs = (GC *) calloc (sizeof(GC), st->count * 2);
302
303     st->diaglim  = get_float_resource (st->dpy, "diaglim", "Float");
304     if (st->diaglim < 1.0)
305     {
306         st->diaglim = 1.0;
307     }
308     else if (st->diaglim > 2.0)
309     {
310         st->diaglim = 2.0;
311     }
312     st->diaglim *= st->orthlim;
313
314     st->anychan  = get_float_resource (st->dpy, "anychan", "Float");
315     if (st->anychan < 0.0)
316     {
317         st->anychan = 0.0;
318     }
319     else if (st->anychan > 1.0)
320     {
321         st->anychan = 1.0;
322     }
323     
324     st->minorchan = get_float_resource (st->dpy, "minorchan","Float");
325     if (st->minorchan < 0.0)
326     {
327         st->minorchan = 0.0;
328     }
329     else if (st->minorchan > 1.0)
330     {
331         st->minorchan = 1.0;
332     }
333     
334     st->instantdeathchan = get_float_resource (st->dpy, "instantdeathchan","Float");
335     if (st->instantdeathchan < 0.0)
336     {
337         st->instantdeathchan = 0.0;
338     }
339     else if (st->instantdeathchan > 1.0)
340     {
341         st->instantdeathchan = 1.0;
342     }
343
344     st->minlifespan = get_integer_resource (st->dpy, "minlifespan", "Integer");
345     if (st->minlifespan < 1)
346     {
347         st->minlifespan = 1;
348     }
349
350     st->maxlifespan = get_integer_resource (st->dpy, "maxlifespan", "Integer");
351     if (st->maxlifespan < st->minlifespan)
352     {
353         st->maxlifespan = st->minlifespan;
354     }
355
356     st->minlifespeed = get_float_resource (st->dpy, "minlifespeed", "Float");
357     if (st->minlifespeed < 0.0)
358     {
359         st->minlifespeed = 0.0;
360     }
361     else if (st->minlifespeed > 1.0)
362     {
363         st->minlifespeed = 1.0;
364     }
365
366     st->maxlifespeed = get_float_resource (st->dpy, "maxlifespeed", "Float");
367     if (st->maxlifespeed < st->minlifespeed)
368     {
369         st->maxlifespeed = st->minlifespeed;
370     }
371     else if (st->maxlifespeed > 1.0)
372     {
373         st->maxlifespeed = 1.0;
374     }
375
376     st->mindeathspeed = get_float_resource (st->dpy, "mindeathspeed", "Float");
377     if (st->mindeathspeed < 0.0)
378     {
379         st->mindeathspeed = 0.0;
380     }
381     else if (st->mindeathspeed > 1.0)
382     {
383         st->mindeathspeed = 1.0;
384     }
385
386     st->maxdeathspeed = get_float_resource (st->dpy, "maxdeathspeed", "Float");
387     if (st->maxdeathspeed < st->mindeathspeed)
388     {
389         st->maxdeathspeed = st->mindeathspeed;
390     }
391     else if (st->maxdeathspeed > 1.0)
392     {
393         st->maxdeathspeed = 1.0;
394     }
395
396     st->minlifespeed *= st->diaglim;
397     st->maxlifespeed *= st->diaglim;
398     st->mindeathspeed *= st->diaglim;
399     st->maxdeathspeed *= st->diaglim;
400
401     cmap = xgwa.colormap;
402     
403     st->windowWidth = xgwa.width;
404     st->windowHeight = xgwa.height;
405     
406     st->arr_width = st->windowWidth / cell_size;
407     st->arr_height = st->windowHeight / cell_size;
408
409     alloc_size = sizeof(cell) * st->arr_width * st->arr_height;
410     oalloc = alloc_size;
411
412     if (mem_throttle > 0)
413       while (cell_size < st->windowWidth/10 &&
414              cell_size < st->windowHeight/10 &&
415              alloc_size > mem_throttle)
416         {
417           cell_size++;
418           st->arr_width = st->windowWidth / cell_size;
419           st->arr_height = st->windowHeight / cell_size;
420           alloc_size = sizeof(cell) * st->arr_width * st->arr_height;
421         }
422
423     if (osize != cell_size)
424       {
425         if (!st->warned)
426           {
427             fprintf (stderr,
428              "%s: throttling cell size from %d to %d because of %dM limit.\n",
429                      progname, osize, cell_size, mem_throttle / (1 << 20));
430             fprintf (stderr, "%s: %dx%dx%d = %.1fM, %dx%dx%d = %.1fM.\n",
431                      progname,
432                      st->windowWidth, st->windowHeight, osize,
433                      ((float) oalloc) / (1 << 20),
434                      st->windowWidth, st->windowHeight, cell_size,
435                      ((float) alloc_size) / (1 << 20));
436             st->warned = 1;
437           }
438       }
439
440     st->xSize = st->arr_width ? st->windowWidth / st->arr_width : 0;
441     st->ySize = st->arr_height ? st->windowHeight / st->arr_height : 0;
442     if (st->xSize > st->ySize)
443     {
444         st->xSize = st->ySize;
445     }
446     else
447     {
448         st->ySize = st->xSize;
449     }
450     
451     st->xOffset = (st->windowWidth - (st->arr_width * st->xSize)) / 2;
452     st->yOffset = (st->windowHeight - (st->arr_height * st->ySize)) / 2;
453
454     if (st->originalcolors)
455     {
456         setup_original_colormap (st, &xgwa);
457     }
458     else
459     {
460         setup_random_colormap (st, &xgwa);
461     }
462 }
463
464 static void drawblock (struct state *st, int x, int y, unsigned char c)
465 {
466   if (st->xSize == 1 && st->ySize == 1)
467     XDrawPoint (st->dpy, st->window, st->coloredGCs[c], x + st->xOffset, y + st->yOffset);
468   else
469     XFillRectangle (st->dpy, st->window, st->coloredGCs[c],
470                     x * st->xSize + st->xOffset, y * st->ySize + st->yOffset,
471                     st->xSize, st->ySize);
472 }
473
474 static void setup_arr (struct state *st)
475 {
476     int x, y;
477
478     if (st->arr != NULL)
479     {
480         free (st->arr);
481     }
482
483     XFillRectangle (st->dpy, st->window, st->coloredGCs[0], 0, 0, 
484                     st->windowWidth, st->windowHeight);
485     
486     if (!st->arr_width) st->arr_width = 1;
487     if (!st->arr_height) st->arr_height = 1;
488
489     st->arr = (cell *) calloc (sizeof(cell), st->arr_width * st->arr_height);  
490     if (!st->arr)
491       {
492         fprintf (stderr, "%s: out of memory allocating %dx%d grid\n",
493                  progname, st->arr_width, st->arr_height);
494         exit (1);
495       }
496
497     for (y = 0; y < st->arr_height; y++)
498     {
499       int row = y * st->arr_width;
500        for (x = 0; x < st->arr_width; x++) 
501         {
502             st->arr[row+x].speed = 0.0;
503             st->arr[row+x].growth = 0.0;
504             st->arr[row+x].col = 0;
505             st->arr[row+x].isnext = 0;
506             st->arr[row+x].next = 0;
507             st->arr[row+x].prev = 0;
508         }
509     }
510
511     if (st->head == NULL)
512     {
513         st->head = (cell *) malloc (sizeof (cell));
514     }
515     
516     if (st->tail == NULL)
517     {
518         st->tail = (cell *) malloc (sizeof (cell));
519     }
520
521     st->head->next = st->tail;
522     st->head->prev = st->head;
523     st->tail->next = st->tail;
524     st->tail->prev = st->head;
525
526     st->blastcount = random_life_value (st);
527 }
528
529 static void newcell (struct state *st, cell *c, unsigned char col, FLOAT sp)
530 {
531     if (! c) return;
532     
533     if (c->col == col) return;
534     
535     c->nextcol = col;
536     c->nextspeed = sp;
537     c->isnext = 1;
538     
539     if (c->prev == 0) {
540         c->next = st->head->next;
541         c->prev = st->head;
542         st->head->next = c;
543         c->next->prev = c;
544     }
545 }
546
547 static void killcell (struct state *st, cell *c)
548 {
549     c->prev->next = c->next;
550     c->next->prev = c->prev;
551     c->prev = 0;
552     c->speed = 0.0;
553     drawblock (st, cell_x(c), cell_y(c), c->col);
554 }
555
556
557 static void randblip (struct state *st, int doit)
558 {
559     int n;
560     int b = 0;
561     if (!doit 
562         && (st->blastcount-- >= 0) 
563         && (RAND_FLOAT > st->anychan))
564     {
565         return;
566     }
567     
568     if (st->blastcount < 0) 
569     {
570         b = 1;
571         n = 2;
572         st->blastcount = random_life_value (st);
573         if (RAND_FLOAT < st->instantdeathchan)
574         {
575             /* clear everything every so often to keep from getting into a
576              * rut */
577             setup_arr (st);
578             b = 0;
579         }
580     }
581     else if (RAND_FLOAT <= st->minorchan) 
582     {
583         n = 2;
584     }
585     else 
586     {
587         n = random () % 3 + 3;
588     }
589     
590     while (n--) 
591     {
592       int x = st->arr_width ? random () % st->arr_width : 0;
593       int y = st->arr_height ? random () % st->arr_height : 0;
594         int c;
595         FLOAT s;
596         if (b)
597         {
598             c = 0;
599             s = RAND_FLOAT * (st->maxdeathspeed - st->mindeathspeed) + st->mindeathspeed;
600         }
601         else
602         {
603             c = ((st->count - 1) ? random () % (st->count-1) : 0) + 1;
604             s = RAND_FLOAT * (st->maxlifespeed - st->minlifespeed) + st->minlifespeed;
605         }
606         newcell (st, &st->arr[y * st->arr_width + x], c, s);
607     }
608 }
609
610 static void update (struct state *st)
611 {
612     cell *a;
613     
614     for (a = st->head->next; a != st->tail; a = a->next) 
615     {
616         static const XPoint all_coords[] = {{-1, -1}, {-1, 1}, {1, -1}, {1, 1},
617                                             {-1,  0}, { 1, 0}, {0, -1}, {0, 1},
618                                             {99, 99}};
619
620         const XPoint *coords = 0;
621
622         if (a->speed == 0) continue;
623         a->growth += a->speed;
624
625         if (a->growth >= st->diaglim) 
626         {
627             coords = all_coords;
628         }
629         else if (a->growth >= st->orthlim)
630         {
631             coords = &all_coords[4];
632         }
633         else
634         {
635             continue;
636         }
637
638         while (coords->x != 99)
639         {
640             int x = cell_x(a) + coords->x;
641             int y = cell_y(a) + coords->y;
642             coords++;
643
644             if (x < 0) x = st->arr_width - 1;
645             else if (x >= st->arr_width) x = 0;
646             
647             if (y < 0) y = st->arr_height - 1;
648             else if (y >= st->arr_height) y = 0;
649             
650             newcell (st, &st->arr[y * st->arr_width + x], a->col, a->speed);
651         }
652
653         if (a->growth >= st->diaglim) 
654             killcell (st, a);
655     }
656
657     randblip (st, (st->head->next) == st->tail);
658
659     for (a = st->head->next; a != st->tail; a = a->next)
660     {
661         if (a->isnext) 
662         {
663             a->isnext = 0;
664             a->speed = a->nextspeed;
665             a->growth = 0.0;
666             a->col = a->nextcol;
667             drawblock (st, cell_x(a), cell_y(a), a->col + st->count);
668         }
669     }
670 }
671
672 static void *
673 petri_init (Display *dpy, Window win)
674 {
675     struct state *st = (struct state *) calloc (1, sizeof(*st));
676     st->dpy = dpy;
677     st->window = win;
678
679     st->delay = get_integer_resource (st->dpy, "delay", "Delay");
680     st->orthlim = 1;
681
682     setup_display (st);
683     setup_arr (st);
684     randblip (st, 1);
685     
686     return st;
687 }
688
689 static unsigned long
690 petri_draw (Display *dpy, Window window, void *closure)
691 {
692   struct state *st = (struct state *) closure;
693   update (st);
694   return st->delay;
695 }
696
697 static void
698 petri_reshape (Display *dpy, Window window, void *closure, 
699                  unsigned int w, unsigned int h)
700 {
701 }
702
703 static Bool
704 petri_event (Display *dpy, Window window, void *closure, XEvent *event)
705 {
706   return False;
707 }
708
709 static void
710 petri_free (Display *dpy, Window window, void *closure)
711 {
712   struct state *st = (struct state *) closure;
713   free (st);
714 }
715
716
717
718 static const char *petri_defaults [] = {
719   ".background:         black",
720   ".foreground:         white",
721   "*delay:              10000",
722   "*count:              20",
723   "*size:               2",
724   "*diaglim:            1.414",
725   "*anychan:            0.0015",
726   "*minorchan:          0.5",
727   "*instantdeathchan:   0.2",
728   "*minlifespan:        500",
729   "*maxlifespan:        1500",
730   "*minlifespeed:       0.04",
731   "*maxlifespeed:       0.13",
732   "*mindeathspeed:      0.42",
733   "*maxdeathspeed:      0.46",
734   "*originalcolors:     false",
735   "*memThrottle:        22M",   /* don't malloc more than this much.
736                                    Scale the pixels up if necessary. */
737     0
738 };
739
740 static XrmOptionDescRec petri_options [] = {
741   { "-delay",            ".delay",              XrmoptionSepArg, 0 },
742   { "-size",             ".size",               XrmoptionSepArg, 0 },
743   { "-count",            ".count",              XrmoptionSepArg, 0 },
744   { "-diaglim",          ".diaglim",            XrmoptionSepArg, 0 },
745   { "-anychan",          ".anychan",            XrmoptionSepArg, 0 },
746   { "-minorchan",        ".minorchan",          XrmoptionSepArg, 0 },
747   { "-instantdeathchan", ".instantdeathchan",   XrmoptionSepArg, 0 },
748   { "-minlifespan",      ".minlifespan",        XrmoptionSepArg, 0 },
749   { "-maxlifespan",      ".maxlifespan",        XrmoptionSepArg, 0 },
750   { "-minlifespeed",     ".minlifespeed",       XrmoptionSepArg, 0 },
751   { "-maxlifespeed",     ".maxlifespeed",       XrmoptionSepArg, 0 },
752   { "-mindeathspeed",    ".mindeathspeed",      XrmoptionSepArg, 0 },
753   { "-maxdeathspeed",    ".maxdeathspeed",      XrmoptionSepArg, 0 },
754   { "-originalcolors",   ".originalcolors",     XrmoptionNoArg,  "true" },
755   { "-mem-throttle",     ".memThrottle",        XrmoptionSepArg,  0 },
756   { 0, 0, 0, 0 }
757 };
758
759
760 XSCREENSAVER_MODULE ("Petri", petri)