REM REM Print SINUS and COSINUS in ASCII terminal REM Works with all terminal sizes! REM REM PvE - Sept 2014 - GPL v3. REM REM Compile method #1: REM # m4 basic.m4 sinus.m4b |indent > sinus.c REM # gcc -o sinus sinus.c -lm -lgc REM REM Compile method #2: REM # m4basic sinus REM ---------------------------------------------------------------------------- REM Clear the screen CLEAR REM Delay on X-axis CONST factor = 10 FLOAT x, y INTEGER columns, rows REM Get terminal size LET columns = COLUMNS LET rows = ROWS - 1 REM Start sinus waves FOR x = 1 TO columns LET y = SIN(x/factor) GOTOXY x, rows/2 + 1 + y*rows/2 COLOR FOREGROUND TO BLUE PRINT "X" LET y = COS(x/factor + PI/2) GOTOXY x, rows/2 + 1 + y*rows/2 COLOR FOREGROUND TO RED PRINT "O" NEXT REM Reset to default color COLOR RESET
Return to M4BASIC