Created function for converting north/south/east/west directions to top/bottom/left/right. Implemented use of function.

Not sure if I'm doing the function declaration correctly. Please check.