Created
December 1, 2012 23:54
-
-
Save mlc/4186000 to your computer and use it in GitHub Desktop.
port of 10 PRINT to C
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
/* | |
* port of | |
* 10 PRINT CHR$(205.5+RND(1)); : GOTO 10 | |
* to modern-ish C | |
*/ | |
#include <locale.h> | |
#include <wchar.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdio.h> | |
#define US_IN_NS 1000 | |
#define MS_IN_NS (1000*US_IN_NS) | |
int main(int argc, char** argv) { | |
unsigned int seed = time(NULL); | |
struct timespec ns; | |
ns.tv_sec = 0; | |
ns.tv_nsec = 5 * MS_IN_NS; | |
setlocale(LC_ALL, ""); | |
while(1) { | |
putwchar(0x2571 + (rand_r(&seed) & 1)); | |
fflush(stdout); | |
nanosleep(&ns, NULL); | |
} | |
return 0; | |
} |
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
╲╲╱╲╲╲╲╲╲╲╱╱╲╱╱╱╱╲╲╱╱╱╲╲╲╲╲╲╱╱╱╱╱╲╱╱╱╱╱╲╱╲╲╲╲╱╲╲╲╲╲╲╲╱╲╲╲╲╲╲╲╲╲╲╲╲╲╱╱╱╱╲╱╲╲╲╱╱╱╱ | |
╱╱╲╲╲╱╱╲╲╱╲╲╲╲╱╲╲╲╲╱╲╱╱╲╱╱╱╱╲╲╲╱╲╱╱╱╱╲╲╲╲╱╱╱╲╲╲╱╲╱╲╱╲╲╱╱╲╲╲╱╱╱╲╲╲╱╱╱╱╱╱╱╱╱╱╲╲╲╱╱ | |
╲╲╱╲╲╲╱╱╱╱╲╱╲╱╱╲╲╱╲╱╲╱╲╱╱╲╱╱╱╲╱╲╱╱╱╲╱╲╱╲╲╱╱╱╲╱╱╲╲╲╱╱╲╱╲╲╲╲╱╱╲╱╱╱╲╱╲╲╱╲╲╲╱╱╱╲╲╲╱╱ | |
╱╱╱╱╱╲╲╲╱╱╱╲╱╲╱╱╱╲╲╲╱╲╲╱╲╲╲╱╱╲╱╱╲╲╱╱╲╲╱╱╱╲╲╲╱╱╱╲╱╲╲╱╲╱╱╱╱╱╱╱╱╲╱╱╱╱╲╱╲╲╱╱╲╱╲╱╲╲╱╱ | |
╲╲╲╲╲╲╱╲╲╱╱╱╱╱╱╱╱╱╱╱╲╲╲╲╱╱╱╱╱╲╲╲╱╱╲╱╲╱╲╱╲╱╱╱╲╲╲╱╲╲╱╱╲╱╲╱╱╲╲╱╱╱╱╱╱╲╱╱╲╲╱╱╲╲╲╲╲╲╱╱ | |
╱╱╱╲╱╱╱╲╲╲╲╱╲╲╱╲╲╲╱╲╱╲╱╲╱╱╱╱╲╲╲╱╱╱╲╲╱╲╲╲╲╲╲╲╱╱╱╱╱╱╱╱╲╱╱╱╱╲╱╲╲╱╱╱╲╲╲╲╱╲╲╱╲╱╲╱╱╲╲╲ | |
╱╱╱╲╱╲╱╲╱╲╱╲╱╱╲╲╱╲╱╲╲╲╲╲╱╱╲╲╲╲╱╲╲╱╱╲╱╱╱╱╲╲╲╱╱╱╲╲╱╱╱╱╲╲╱╱╲╲╲╲╱╲╱╱╱╱╲╲╱╲╲╲╲╱╲╱╱╲╲╲ | |
╲╱╱╱╲╲╱╱╲╱╲╲╱╲╱╲╱╲╲╱╱╱╲╱╱╲╱╲╲╱╲╱╲╱╲╱╲╱╲╲╱╲╱╱╲╲╱╲╲╱╲╲╱╲╱╱╲╲╱╲╲╱╲╱╲╱╲╱╱╱╲╱╱╲╱╲╱╱╱╱ | |
╲╱╲╱╲╲╲╲╲╲╱╲╲╱╲╲╱╲╱╲╲╱╲╲╱╲╲╱╲╱╱╱╲╱╲╱╱╲╱╱╱╲╲╲╱╲╲╲╲╲╱╲╱╲╱╲╲╱╲╱╲╱╲╱╱╱╱╲╱╲╱╱╲╱╲╱╲╲╱╱ | |
╲╱╱╲╱╲╱╱╲╲╲╲╲╲╱╲╲╲╱╱╱╱╲╲╲╲╱╲╱╲╲╲╱╲╱╲╱╱╲╱╲╲╲╲╲╱╲╲╱╲╲╲╱╱╲╲╱╲╱╱╲╲╱╱╱╲╱╲╱╲╱╲╱╲╲╱╱╱╱╲ | |
╱╲╱╲╱╲╲╱╲╲╱╲╲╱╲╱╱╱╲╲╲╱╲╲╱╲╲╱╱╲╲╲╱╲╱╲╲╱╲╱╲╱╲╱╲╱╲╲╲╱╱╲╱╱╱╲╱╱╲╲╱╱╲╲╱╱╱╲╱╱╱╱╱╲╱╲╲╱╱╱ | |
╲╱╲╲╲╱╲╱╲╲╱╲╲╲╱╲╲╲╲╱╲╲╱╲╲╲╱╲╱╲╱╲╲╱╱╲╱╲╲╱╲╲╲╲╲╲╱╲╲╲╱╱╲╱╲╲╲╲╱╱╲╲╱╲╱╲╱╱╱╱╲╱╲╲╲╲╲╱╱╲ | |
╲╲╱╱╲╲╱╲╱╲╲╲╱╲╱╱╱╱╲╱╱╱╲╱╱╱╱╱╱╲╲╲╲╲╱╱╲╱╲╲╲╱╱╱╱╲╲╲╱╱╲╲╲╱╲╱╱╲╱╲╱╲╲╱╱╱╲╲╱╱╱╲╱╲╱╱╱╱╲╱ | |
╲╱╱╲╱╲╲╱╲╱╱╱╱╲╱╱╲╲╲╱╲╱╲╲╱╲╲╲╱╱╱╱╲╲╲╱╲╲╱╱╱╱╱╲╲╱╲╱╱╲╱╱╱╲╲╱╱╲╲╱╲╱╲╲╱╱╲╱╱╲╱╱╱╲╱╱╲╱╱╲ | |
╱╲╱╱╱╱╲╱╱╱╲╲╱╲╱╲╲╲╲╲╱╲╲╲╱╲╲╲╲╱╲╲╱╱╱╱╲╲╲╱╲╲╲╲╲╱╲╱╲╲╱╲╱╲╲╲╱╲╲╲╲╲╱╱╲╲╱╲╱╱╲╱╲╱╲╱╱╱╲╱ | |
╲╲╲╲╱╲╱╲╱╱╲╱╱╱╱╲╲╲╱╲╱╱╱╲╲╱╱╲╱╲╲╲╱╱╲╲╲╲╲╱╱╲╲╱╲╱╱╲╱╲╲╱╲╲╱╲╱╱╱╱╱╱╱╲╱╲╲╲╱╱╲╱╲╲╲╲╱╱╱╱ | |
╲╲╱╲╱╱╲╱╱╲╲╲╲╲╲╲╲╲╱╲╲╲╲╲╱╱╱╲╱╲╱╲╲╱╲╲╲╱╱╱╱╲╱╱╲╲╲╲╱╲╱╲╲╲╲╱╱╱╱╱╲╱╱╱╲╲╱╲╲╱╲╲╲╱╱╲╲╱╲╲ | |
╱╱╲╲╱╱╲╱╱╲╲╱╱╱╲╲╲╲╱╱╲╲╱╱╲╱╲╱╱╲╱╲╲╲╱╲╲╲╲╲╱╱╱╲╱╲╲╱╲╲╲╱╱╲╱╲╲╲╲╲╱╲╲╲╱╱╱╱╲╲╱╱╱╱╱╲╲╱╱╲ | |
╲╱╲╲╱╲╲╲╱╱╱╲╱╱╱╲╱╱╱╱╱╲╲╲╱╱╲╲╱╱╲╱╲╲╱╱╲╲╲╱╱╲╱╱╱╲╲╲╲╱╱╱╲╱╱╱╱╲╲╲╱╱╲╲╲╱╲╲╲╱╲╲╲╲╱╱╲╱╱╲ | |
╱╲╱╱╲╲╲╲╲╲╱╲╲╲╱╲╱╱╲╲╱╱╱╱╱╲╲╲╲╱╱╱╱╱╱╲╱╲╱╱╱╱╱╲╱╱╱╱╲╲╱╲╱╱╱╱╱╱╲╲╲╲╲╱╲╱╱╲╱╱╱╲╲╲╱╲╱╱╱╲ | |
╲╲╱╱╱╲╲╲╱╲╱╱╱╱╲╲╱╱╱╲╲╲╱╱╲╱╲╲╲╱╱╲╱╲╲╲╲╲╱╱╲╲╲╱╱╱╱╲╲╱╱╲╲╲╱╲╲╱╲╲╱╱╱╱╲╱╱╱╱╲╲╲╲╲╱╲╱╱╱╱ | |
╲╲╲╱╲╲╱╲╲╱╱╱╲╲╱╱╱╱╱╱╲╲╱╲╱╲╲╱╲╲╱╱╲╱╱╱╱╱╱╱╱╲╱╱╲╲╲╱╲╲╲╲╱╱╲╱╲╱╲╲╱╲╲╲╲╱╲╱╲╲╱╲╱╱╱╱╲╱╱╲ | |
╱╱╲╲╱╱╲╲╲╱╱╲╲╲╱╱╱╱╱╱╲╲╲╲╱╱╲╱╲╲╲╲╱╲╱╱╱╱╲╲╱╲╱╲╱╲╲╱╱╲╱╱╱╱╱╲╲╱╲╲╱╲╱╲╲╲╲╱╲╲╱╲╲╱╱╲╱╱╱╲ | |
╱╱╲╱╱╲╲╱╲╱╱╱╱╱╲╲╲╱╱╲╲╱╲╱╲╱╲╲╱╱╱╱╲╲╲╱╲╱╱╱╲╲╱╲╱╲╲╲╲╱╲╲╱╱╲╱╱╲╲╱╱╱╲╲╲╲╲╲╱╱╱╱╱╱╱╲╲╱╱╲ | |
╱╱╲╱╱╲╲╱╲╲╱╲╲╲╲╱╲╱╲╱╱╲╲╲╱╱╱╱╲╱╱╲╱╲╱╱╲╱╱╱╲╲╱╱╱╲╲╲╱╲╲╲╱╲╲╲╱╱╱╱╲╲╱╲╱╲╲╱╲╲╲╱╱╲╲╱╲╲╲╲ | |
╱╱╱╲╱╱╲╲╱╲╲╱╱╱╲╲╲╱╱╱╱╲╱╱╱╱╱╲╲╲╱╱╱╱╱╱╱╲╲╲╲╱╲╱╱╱╲╲╲╲╲╱╱╱╲╱╱╲╱╲╲╱╱╲╲╱╱╱╲╱╱╲╱╲╲╱╱╲╱╱ | |
╲╱╲╱╲╲╲╱╲╲╲╱╲╱╲╱╲╱╱╲╱╲╱╱╲╲╲╱╲╱╲╱╲╱╱╱╲╲╱╱╱╲╲╱╱╱╱╱╲╲╱╲╱╲╲╱╲╱╲╱╲╲╱╲╱╱╲╱╱╲╱╱╱╱╲╲╲╲╲╲ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment