# Snakes

The cell class stores information about the objects currently on the board. If a cell is empty it would contain nothing. If a cell had a snake part or a fruit, it would store it. This was used to determine what would happen once the snake moved onto a cell. If the snake moved onto a cell that had a fruit, it would gain one block to its length.

The snakes body is stored in an array via the coordinates the snake is on. This was used to keep track of where the snake is and those cells in the array were drawn green. When the snake ate a piece of fruit, the coordinate of the fruit would be added to the array and this would slowly cycle it through and act as if the fruit grew by one after leaving the intial fruit location.

<figure><img src="https://2886414827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuVu6MnwL34Z8kSpcNWp%2Fuploads%2FK3mAnqKrm5PYMTqdcEOA%2FUntitled%20video%20-%20Made%20with%20Clipchamp%20(1)%20(1).gif?alt=media&#x26;token=116525d2-8180-4170-8584-333a87efc571" alt=""><figcaption><p>A basic snake game</p></figcaption></figure>
