diff Meerwald/bruyn_common.c @ 0:be303a3f5ea8

import
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Sun, 12 Aug 2007 13:14:34 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Meerwald/bruyn_common.c	Sun Aug 12 13:14:34 2007 +0200
@@ -0,0 +1,44 @@
+#include "bruyn_common.h"
+
+gray lookup_pattern(int pattern, int c, int r) {
+#define A CATEGORY_A
+#define B CATEGORY_B
+
+  gray pattern1[4][4] =
+    {{A, A, B, B},
+     {A, A, B, B},
+     {B, B, A, A},
+     {B, B, A, A}};
+
+  gray pattern2[8][8] =
+    {{B, B, B, B, A, A, A, A},
+     {B, B, B, B, A, A, A, A},
+     {B, B, B, B, A, A, A, A},
+     {B, B, B, B, A, A, A, A},
+     {A, A, A, A, B, B, B, B},
+     {A, A, A, A, B, B, B, B},
+     {A, A, A, A, B, B, B, B},
+     {A, A, A, A, B, B, B, B}};
+
+  gray pattern3[2][2] =
+    {{A, B}, {B, A}};
+
+#undef A
+#undef B
+
+  switch (pattern) {
+    case 1:
+      return pattern1[r % 4][c % 4];
+      break;
+    case 2:
+      return pattern2[r % 8][c % 8];
+      break;
+    case 3:
+      return pattern3[r % 2][c % 2];
+      break;
+  }
+
+  return CATEGORY_VOID;
+}
+
+

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.