Problem with width/2 and height/2

The answer from @wesley is correct if it didn’t work for you then you implemented it incorrectly.
When a sketch is executed the variables width and height start at 100 but are changed when the size(...) method is executed. In your code above the snakes position variables are created and initialised before the call to setup() so use the value 100