|
|
|
@ -18,18 +18,31 @@ const newSnake = require('./wrapper.js') |
|
|
|
|
const dotenv = require('dotenv'); |
|
|
|
|
dotenv.config(); |
|
|
|
|
|
|
|
|
|
const fs = require('fs'); |
|
|
|
|
|
|
|
|
|
let snake = newSnake(process.env.auth) // Login with the auth cookie in the secrets tab
|
|
|
|
|
|
|
|
|
|
var vals = fs.readFileSync("data", 'utf8').split("\n") |
|
|
|
|
|
|
|
|
|
/*File Format: |
|
|
|
|
`${LAST_DEATH} |
|
|
|
|
${BEST_LENGTH} |
|
|
|
|
${TOTAL_ATTEMPTS} |
|
|
|
|
${TOTAL_LENGTH} |
|
|
|
|
${BEST_SEEN} |
|
|
|
|
${BEST_SEEN_WHO} |
|
|
|
|
` |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
horz_dir = LEFT |
|
|
|
|
vert_dir = UP |
|
|
|
|
LAST_DEATH = "" |
|
|
|
|
BEST_LENGTH = 744 |
|
|
|
|
TOTAL_ATTEMPTS = 37 |
|
|
|
|
TOTAL_LENGTH = 8066 |
|
|
|
|
LAST_DEATH = vals[0] |
|
|
|
|
BEST_LENGTH = vals[1] |
|
|
|
|
TOTAL_ATTEMPTS = vals[2] |
|
|
|
|
TOTAL_LENGTH = vals[3] |
|
|
|
|
LAST_LENGTH = 0 |
|
|
|
|
BEST_SEEN = 764 |
|
|
|
|
BEST_SEEN_WHO = "Bot 2578" |
|
|
|
|
BEST_SEEN = vals[5] |
|
|
|
|
BEST_SEEN_WHO = vals[6] |
|
|
|
|
TEST_REGIONS = [] |
|
|
|
|
APPLES_LIST=[] |
|
|
|
|
targetApp={} |
|
|
|
@ -43,6 +56,14 @@ snake.onDeath = function(reason) { // When the snake dies |
|
|
|
|
LAST_DEATH = reason |
|
|
|
|
TOTAL_LENGTH += LAST_LENGTH |
|
|
|
|
LAST_LENGTH = 0 |
|
|
|
|
fs.writeFileSync("data", |
|
|
|
|
`${LAST_DEATH} |
|
|
|
|
${BEST_LENGTH} |
|
|
|
|
${TOTAL_ATTEMPTS} |
|
|
|
|
${TOTAL_LENGTH} |
|
|
|
|
${BEST_SEEN} |
|
|
|
|
${BEST_SEEN_WHO} |
|
|
|
|
`)
|
|
|
|
|
snake.spawn() // Respawn
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|