#!/usr/bin/env python3

import math

#width = int(input('Terminal width: '))
#scale = float(input('scale factor? '))
import shutil
winsize = shutil.get_terminal_size((100,100))
print(winsize)

def trig(x, scale=0.5):
    return (math.sin(x) * math.cos(scale*x))

def build_data(height, scale, xmax):
    data = []
    x =  1e-99
    step = xmax / height
    while x < xmax:
        y = trig(x, scale)
        data.append( (x,y) )
        x += step
    return data
#--------

def main(argv=[__name__]):
    if len(argv) > 1:
        scale = float(argv[1])
    else:
        scale = 0.5
    if len(argv) > 2:
        xmax = float(argv[2])
    else:
        xmax = 10*math.pi
    curve = build_data(winsize.lines, scale, xmax)

    for p in curve:
        col = (winsize.columns + winsize.columns * p[1])/2
        for c in range(int(col)):
            print('=', end='')
        print()
    for i in range(winsize.columns):
        print('.', end='')
    print()
#--------

if __name__ == '__main__':
    import sys
    sys.exit(main(sys.argv))
#--------