update main.cpp : add function row_column_move_amount

add function row_column_move_amount
count number of rows or columns would move on certain direction