snake game algorithm in c