'
' Print SINUS and COSINUS in ASCII terminal
' Works with all terminal sizes!
'
' Requires BaCon 1.0 build 13 or higher.
'
' PvE - May 2010.
'----------------------------------------------------------------------------
' Clear the screen
CLEAR
' Delay on X-axis
CONST factor = 10
DECLARE x, y TYPE FLOATING
COLOR INTENSE
' Get terminal size
columns = COLUMNS
rows = ROWS - 1
' Start sinus waves
FOR x = 1 TO columns
y = SIN(x/factor)
GOTOXY x, rows/2 + 1 + y*rows/2
COLOR FG TO BLUE
PRINT "X";
y = COS(x/factor + PI/2)
GOTOXY x, rows/2 + 1 + y*rows/2
COLOR FG TO RED
PRINT "O";
NEXT
' Reset to default color
COLOR RESET
' Hide cursor
CURSOR OFF
' Wait for key
key = GETKEY
' Get back to normal terminal
CURSOR ON
CLEAR