Game crashes when snake fills up board
dginovker opened this issue · comments
When you beat the game you get:
Uncaught TypeError: Cannot set property '-1' of undefined
at SNAKE.Food.me.randomlyPlaceFood (snake.js:541)
at SNAKE.Board.me.foodEaten (snake.js:981)
at SNAKE.Snake.me.eatFood (snake.js:365)
at SNAKE.Snake.me.go (snake.js:334)
at snake.js:335
In the console, and the game freezes.
edit: The line numbers are off since I was making changes.
Thanks for the report! I'll try and put something in to catch this.
I can also add it. I'm making a few PRs right now.
Sure!
@dginovker told me that I can take this one.
Sounds good
Just reproduced with small board size, snakeSpeed
of 500 (the higher the slower, interesting...), and growthIncr
of 1. I get the following (removed absolute path from .js filename for brevity):
TypeError: playingBoard.grid[row] is undefined snake.js:535:56
randomlyPlaceFood js/snake.js:535
foodEaten js/snake.js:989
eatFood js/snake.js:357
go js/snake.js:326
go js/snake.js:327
Will look into it further.