diff --git a/2011/eastman/README.md b/2011/eastman/README.md index 50b8ede89..0fb3125e4 100644 --- a/2011/eastman/README.md +++ b/2011/eastman/README.md @@ -28,7 +28,7 @@ NOTE: to restore your cursor in your shell, try `reset`. This round program will generate a classic spherical result! You will need a terminal capable of displaying coloured ANSI -characters (for example an xterm or a Terminal.app window). +characters (for example an xterm or a Terminal.app window in macOS). You might also want to turn off any scrollback history. The program will size itself to the initial geometry of your terminal. @@ -41,7 +41,7 @@ large for hi-res graphics! This program uses ANSI graphics to recreate the classic Boing Ball demo from the Commodore Amiga. See if you -aren't familiar with it. Back in its day, this demo inspired lust and awe in +aren't familiar with it. Back in its day, this demo inspired lust and awe in geeks around the world. The graphics are @@ -61,11 +61,13 @@ To compile: cc -lm eastman.c ``` + ### Portability It should be completely portable. I've tested with gcc on Mac OS X 10.7 (Lion) and Fedora 10. I would expect it to work in any Unix-like environment. + ### Obfuscation I have merged expressions wherever possible, making extensive use of ternary @@ -75,22 +77,22 @@ evaluations, is a single expression involving 41 operators. Variables are named alphabetically in the order they are declared. -The third argument to `ioctl()` should really be a `struct winsize`, and I should -then look up the `ws_row` and `ws_col` fields, but that makes it way too obvious -what I'm doing there. Since a `struct winsize` just contains four unsigned shorts, I -replaced it with an array. And since all the values will be much less than -`32767`, I further simplified the type to just `short[]`. +The third argument to `ioctl(2)` should really be a `struct winsize`, and I +should then look up the `ws_row` and `ws_col` fields, but that makes it way too +obvious what I'm doing there. Since a `struct winsize` just contains four +`unsigned short`s, I replaced it with an array. And since all the values will +be much less than `32767`, I further simplified the type to just `short[]`. A wonderful thing about ANSI graphics is that it produces nearly unintelligible -code. Consider the printf spec to print a single space in a desired color: +code. Consider the `printf(3)` spec to print a single space in a desired color: `"\x1B[%dm `. I could have done something to further obfuscate it, but it's already indistinguishable from line noise, so why bother? There are lots of other minor obfuscations to make the code less obvious. For example, I could have written the outer loop as `while(1)`, but why write a 1 -when I can calculate it from the return value of `usleep()` instead? And I could -have written `usleep(80000)`, but `usleep(79383)` just looks so much better. -And so on. +when I can calculate it from the return value of `usleep(3)` instead? And I +could have written `usleep(80000)`, but `usleep(79383)` just looks so much +better. And so on. ## Copyright and CC BY-SA 4.0 License: diff --git a/2011/eastman/boing-ball.mp4 b/2011/eastman/boing-ball.mp4 new file mode 100644 index 000000000..eac128382 Binary files /dev/null and b/2011/eastman/boing-ball.mp4 differ diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 6d61ec566..2c897a82a 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -3225,6 +3225,12 @@ Cody also added the [try.sh](2011/borsanyi/try.sh) script. Cody added the [try.sh](2011/dlowe/try.sh) script. +## [2011/eastman](2011/eastman/eastman.c) ([README.md](2011/eastman/README.md])) + +Cody added the video file [boing-ball.mp4](2011/eastman) which is the demo the +author referred to. + + ## [2011/goren](2011/goren/goren.c) ([README.md](2011/goren/README.md])) Cody fixed this for macOS. Before the fix it segfaulted. It worked fine under