🏆 The Challenge:

We have created a version of snake for you to play with. Your task is to write some basic JavaScript to control the snake. The challenge is for your snake to get as high a score as possible within a time limit.

If you've got any questions, drop me an email at [email protected]. I will reply (even this weekend)

This challenge is definitely not straightforward, nor is there a clear right answer. It's up to you to put some proper thought into it.

https://challenge-teal.vercel.app/challenge

Full screen link:

https://challenge-teal.vercel.app/challenge

💾 How to submit:

Save your code as a Github gist. Email [email protected] with the link.

❓ How does it work?

The snake moves around the board. The board is split into 40 x 40 squares. Each of these squares has coordinates { x, y } between 0 and 39 (because this is JavaScript). Every "tick", the snake moves one square. After the snake has moved, it will use your code to decide whether it should change direction.

Every time the snake eats some food, its tail grows and you get a point. Your task is to write a piece of code that feeds the snake as quickly as possible without letting the snake kill itself.