Created
August 3, 2010 15:35
-
-
Save kusma/506563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAG 3 | |
#define SIZE (1 << MAG) | |
const int seed[2][2] = {{0, 2}, {3, 1}}; | |
int main() | |
{ | |
int x, y; | |
for (y = 0; y < SIZE; ++y, putchar('\n')) | |
for (x = 0; x < SIZE; ++x) { | |
int i, v = 0; | |
for (i = 0; i < MAG; ++i) | |
v = 4 * v + seed[(x >> i) & 1][(y >> i) & 1]; | |
printf("%2d ", v); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment