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
#if 0 | |
gcc -std=c99 -Wall -Wextra -pedantic -g -O4 -march=native $0 -lm || exit 1 | |
./a.out && feh joymap.ppm | |
exit $? | |
#endif | |
// visualization of analog joystick to 8-way digital direction quantization | |
// see https://github.com/sulix/omnispeak/pull/14 | |
#include <stdbool.h> |
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
10 CLS : RESTORE 500 | |
20 READ x,y,u,v | |
30 IF x=999 THEN GOTO 70 | |
40 PLOT 128+x, 88+y : DRAW u-x, v-y | |
50 PLOT 129+x, 88+y : DRAW u-x, v-y | |
60 GOTO 20 | |
70 PRINT AT 21,9; "WHAT, ME WORRY?" | |
80 IF INKEY$ = "" THEN GOTO 80 | |
90 CLS : PRINT "\* 1985 E.C. PUBLICATIONS" | |
500 DATA -27,-11,-23,-6,-28,-13,-22,-6,-20,-5,-12,-5,-27,-14,-26,-13 |
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
#if 0 // self-compiling code | |
gcc -std=c99 -Wall -Wextra -pedantic -Werror -g -O4 -march=native $0 -lm || exit 1 | |
exec time ./a.out | |
#endif | |
// Blue Noise texture generation using the void-and-cluster algorithm | |
// implemented by Martin Fiedler <[email protected]> | |
// using an algorithm description written by Alan Wolfe: | |
// https://blog.demofox.org/2019/06/25/generating-blue-noise-textures-with-void-and-cluster/ |
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
position=<-58825, 5905> velocity=< 8, -6> | |
position=< 50749, -19111> velocity=<-7, 4> | |
position=< 50995, -8236> velocity=<-3, -5> | |
position=< 44611, -17672> velocity=<-8, 1> | |
position=< 41069, -41189> velocity=<-8, 3> | |
position=< 9181, -56028> velocity=<-6, 2> | |
position=<-24979, 38514> velocity=<-2, 1> | |
position=< 19502, 58516> velocity=<-3, -9> | |
position=< 58524, 6506> velocity=<-9, -1> | |
position=<-47781, 14688> velocity=<-1, -3> |
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
10 SCREEN 0: REM This program makes only sense to be run on EGA cards, not VGA! | |
20 SCREEN 9: H% = 105: GOSUB 1000: LOCATE 9 | |
30 PRINT "Notice the nice rainbow colors above? That's what you can get by reprogramming" | |
40 PRINT "the EGA palette. Unfortunately, this only works in 350-line mode." | |
50 PRINT "Press any key to see what it looks like in 200-line mode." | |
60 WHILE INKEY$ = "": WEND | |
70 SCREEN 8: H% = 60: GOSUB 1000: LOCATE 9 | |
80 PRINT "Well, that's not nearly as nice as it was in 350-line mode. Turns out, the EGA" | |
90 PRINT "monitor emulates a CGA monitor in 200-line mode and thus restricts the palette" | |
100 PRINT "to the 16 CGA colors. Reprogramming the EGA palette can shuffle the CGA colors" |
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
#if 0 // self-compiling code | |
gcc -std=c99 -Wall -Wextra -pedantic -g -O3 -march=native $0 -o image_predict || exit 1 | |
exec ./image_predict $* | |
#endif | |
// Example code for pre-filtering operations that transform RGB images into | |
// representations that are better suited for lossless compression | |
// (color channel separation and decorrelation, pixel prediction). | |
// Takes a .ppm file as an input and generates multiple files in the form |
NewerOlder