Reset blocked regions when trying new iterations
This commit is contained in:
parent
c3b0f2e2dc
commit
fcfd6e1e98
8
index.js
8
index.js
@ -25,8 +25,8 @@ horz_dir = LEFT
|
||||
vert_dir = UP
|
||||
LAST_DEATH = ""
|
||||
BEST_LENGTH = 744
|
||||
TOTAL_ATTEMPTS = 36
|
||||
TOTAL_LENGTH = 7848
|
||||
TOTAL_ATTEMPTS = 37
|
||||
TOTAL_LENGTH = 8066
|
||||
LAST_LENGTH = 0
|
||||
BEST_SEEN = 764
|
||||
BEST_SEEN_WHO = "Bot 2578"
|
||||
@ -187,7 +187,10 @@ snake.onTick = function(obj) { // When the game updates
|
||||
if (--appleDepth===0) {
|
||||
return true;
|
||||
} else {
|
||||
var myRegions = [...TEST_REGIONS]
|
||||
while (APPLES_LIST.length>0) {
|
||||
var newApple = APPLES_LIST.shift()
|
||||
TEST_REGIONS=[...myRegions]
|
||||
targetApp={x:newApple[0],y:newApple[1]}
|
||||
diff_x = x - targetApp.x
|
||||
diff_y = y - targetApp.y
|
||||
@ -214,6 +217,7 @@ snake.onTick = function(obj) { // When the game updates
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Math.abs(diff_x) > Math.abs(diff_y)) {
|
||||
if (diff_x > 0) {
|
||||
if (dir !== RIGHT && findPath(LEFT, x - 1, y,appleDepth)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user