Direction at last square block | Function which tells the Current direction ; Driver code
function direction ( R , C ) { if ( R != C && R % 2 == 0 && C % 2 != 0 && R < C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 != 0 && C % 2 == 0 && R > C ) { document . write ( " " ) ; return ; } if ( R == C && R % 2 != 0 && C % 2 != 0 ) { document . write ( " " ) ; return ; } if ( R == C && R % 2 == 0 && C % 2 == 0 ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 != 0 && C % 2 != 0 && R < C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 != 0 && C % 2 != 0 && R > C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 == 0 && C % 2 == 0 && R < C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 == 0 && C % 2 == 0 && R > C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 == 0 && C % 2 != 0 && R > C ) { document . write ( " " ) ; return ; } if ( R != C && R % 2 != 0 && C % 2 == 0 && R < C ) { document . write ( " " ) ; return ; } } let R = 3 , C = 1 ; direction ( R , C ) ;