Bad implementation of snake game in c with ncurses