cycle using trig (slooow :( )
rewrite using tables (not tested)
code for turns (NOT TESTED)