optimized turnmove.py