~shockham/cligen

f3ffb99ee7d68a2bec036d9689866a61e35d7ba3 — shockham 1 year, 1 month ago
init
3 files changed, 50 insertions(+), 0 deletions(-)

A .gitignore
A Makefile
A main.c
A  => .gitignore +1 -0
@@ 1,1 @@
main

A  => Makefile +16 -0
@@ 1,16 @@
BIN := main

all: compile run

compile:
	cc main.c -lm -o $(BIN)

compress:
	strip $(BIN)
	upx $(BIN)

run:
	./$(BIN)

clean:
	rm ./$(BIN)

A  => main.c +33 -0
@@ 1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define HEIGHT 40
#define WIDTH 80

int main(void)
{
    int i, j, n;
    double x, y, acc;

    acc = 0.0;

    while(1) {
        for (i = 1; i < HEIGHT; i++) {
            for (j = 1; j < WIDTH; j++) {
                x = (double)(M_PI * (i / (double)HEIGHT));
                y = (double)(M_PI * (j / (double)WIDTH));
                n = (0.5 + cos(x + acc) * 0.5 + sin(y + acc)) * (231.0 * tan(acc));
                // n = ((0.5 + cos(x)) * (0.5 + sin(y))) * 231;
                // n = ((1.0 + cos(x)) * (1.0 + sin(y))) * 231;
                // n = (((1.0 + cos(x)) * (1.0 + sin(y))) * 16) + 232;
                printf("\033[48;5;%dm ", abs(n));
            }
            printf("\033[0;0m\n");
        }
        acc += 0.001;
        printf("\033[40F\n");
    }
    
    return 0;
}