Google interview question

implement gluttonous snake(only the core code)