Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

\prog\ challenge

Name: Anonymous 2020-09-09 19:33

Just post any fucking code, can be fibs or even hello world

Name: Anonymous 2020-09-28 23:00

// https://fabiensanglard.net/fizzlefade/index.php
// uses a LCG instead of LFSR

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

enum { W=80, H=24, N=(W*H) };
enum { A=37, B=39 }; // relatively prime A, B, N
int array[N];

#define pr(...) do { printf( __VA_ARGS__); fflush(stdout); } while(0)
void gotoxy(int col, int row) { pr("\e[%d;%dH", row+1, col+1); }
void clear() { pr("\e[H\e[J"); }

int main() {
int pos = rand() % N;
clear();

for(int i = 0; i < N; i++) {
int row = pos / W, col = pos % W;
usleep(10000);
gotoxy(col, row);
if(array[pos]++) pr("="); else pr("*");
pos = (A*pos + B) % N; // Linear Congruence Generator (LCG)
}
gotoxy(0, H);
return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List