c version
This commit is contained in:
parent
c74914336e
commit
cdaa7bce4b
1 changed files with 27 additions and 0 deletions
27
maze.c
Normal file
27
maze.c
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue