Update snake.cpp

make it shorter