Why is buggy a snake?

link to the snake https://codepen.io/Sandy.Braun3/pen/PvYxaN?editors=1010
Bug felts in the method of adding fruit addFruit() method or in the end of the game End()
here is a screen where the first the coordinates are not "occupied" by a snake(Calculate, so why > XS)of X and Y respectively
and the bottom is the coordinates that the snake X and Y (above X, below Y)
I assume that the bug is either in the recording of the coordinates of the snake what happens with every movement, or a bug in finding empty coordinates.
Comments are present, if a little the code is intuitive, quickly realizes what's happening.
I really hope that there is someone who is not too lazy to climb on someone else's bad code. Thanks in advance
An example of an error snake continues to work, but doesn't eat
Fruit has been inside the snake
March 20th 20 at 11:45
0 answer

Find more questions by tags JavaScript