灵感来源:https://www.codewars.com/kata/simple-fun-number-183-direction-in-grid/javascript