Fixed issue where the snake could go backwards into itself and die, due to the user being to fast when switching directions

Added a "memory" variable which records the previous direction the snake actually moved on. If the new, chosen direction is on the same axis, it will be ignored.
Changed function name