-
-
Save mlcollard/29b30a1951022b878e0c69f0a183d634 to your computer and use it in GitHub Desktop.
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
/* | |
dance.cpp | |
Single line ASCII dancer who dances forever | |
*/ | |
#include <iostream> | |
#include <unistd.h> | |
useconds_t MOVE_SPEED = 500000; | |
const char* DANCE_MOVES[] = { | |
"(>'-')>", | |
"<('-'<)", | |
"^('-')^", | |
"v('-')v", | |
"(>'-')>", | |
" (^-^) " | |
}; | |
int main() { | |
// unbuffered output for std::cout | |
std::cout.setf(std::ios::unitbuf); | |
while (true) { | |
for(int i = 0; i < 6; ++i) { | |
std::cout << DANCE_MOVES[i] << '\r'; | |
usleep(MOVE_SPEED); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment