changed turn function to include directions left to avoid stack overflows