update main.cpp : add function and TEST_1

add function determine_direction ：determine direction

TEST_1 : need to delete the comment at line 303 and line 380
         and comment the original main
         and delete the comment of /* #define TEST_1 */ at line 16