Function to find the direction when stopped moving
function findDirection ( n , m ) { if ( n > m ) { if ( m % 2 == 0 ) document . write ( " " ) ; else document . write ( " " ) ; } else { if ( n % 2 == 0 ) document . write ( " " ) ; else document . write ( " " ) ; } }