Merry Christmas from me at Acodemics!
Here’s a little bit of code that will make snowfall in your terminal, it’s awkward on purpose 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#include <iostream> #include <time.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdint.h> int main() { const int w = 80; const int h = 24; uint16_t a[h][w] = {0x2000}; for(;;) { for(int i = 0; i < h-1; ++i) { for(int j = 0; j < w; ++j) { if(!i && !(rand() % 5)) a[0][j] = 0x2A00; std::cout << char(a[i][j] >> 8); if(a[i][j] == 0x2A00) { a[i+1][j] = 0x2A01; a[i][j] = 0x2000; } } std::cout << std::endl; } for(int i = 0; i < h; ++i) for(int j = 0; j < w; ++j) a[i][j] &= 0xFF00; usleep(250000); } return 0; } |
Questions? Comments?