Add function get_direction

This function gets the next command and gets the direction for the next cell after that it checks if the maze has changed. If so then it stop