diff --git a/index.js b/index.js index 1f7189d..6849132 100644 --- a/index.js +++ b/index.js @@ -70,7 +70,7 @@ snake.onTick = function(obj) { // When the game updates console.log(`The closest apple is at X ${closestApple.x}, Y ${closestApple.y}`) console.log(`The best apple is at X ${bestApp.x}, Y ${bestApp.y}`) console.log(`Last Death reason was: ${LAST_DEATH}`) - console.log(`\nBest Length:${BEST_LENGTH}\nAverage Length:${Math.floor((TOTAL_LENGTH + snake.me()?.body.length) / TOTAL_ATTEMPTS)}\nTotal Spawns:${TOTAL_ATTEMPTS}\n\nBest Seen:${BEST_SEEN_WHO} - ${BEST_SEEN}`) + console.log(`\nBest Length:${BEST_LENGTH}\nAverage Length:${Math.floor((TOTAL_LENGTH + snake.me()?.body.length) / TOTAL_ATTEMPTS)}\nCurrent Length:${snake.me()?.body.length}\nTotal Spawns:${TOTAL_ATTEMPTS}\n\nBest Seen:${BEST_SEEN_WHO} - ${BEST_SEEN}`) //console.log(JSON.stringify(obj)); @@ -152,7 +152,7 @@ snake.onTick = function(obj) { // When the game updates return false; } } - for (var i of snake.me().body) { + for (var i of snake.me()?.body) { if (i[0] === newCoords[0] && i[1] === newCoords[1]) { return false; }