c version

This commit is contained in:
mehbark 2024-12-12 14:46:54 -05:00
parent c74914336e
commit cdaa7bce4b

27
maze.c Normal file
View file

@ -0,0 +1,27 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define BUF_SIZE 8192
int main() {
srand(time(NULL));
char buf[BUF_SIZE];
for (;;) {
for (int i = 0; i < BUF_SIZE;) {
int bits = rand();
for (int bit_idx = 0; bit_idx < 32; bit_idx++) {
int bit = (bits >> bit_idx) & 1;
if (bit) {
buf[i++] = '/';
} else {
buf[i++] = '\\';
}
}
}
fwrite(buf, sizeof(char), BUF_SIZE, stdout);
}
}