added "real ai "ai snake
This commit is contained in:
@@ -582,7 +582,6 @@ function snakeAIappleBias(){
|
||||
preferredDirections.push(3);
|
||||
}
|
||||
|
||||
// 65% chance to go toward apple
|
||||
if (
|
||||
preferredDirections.length > 0 &&
|
||||
random() < 0.65
|
||||
@@ -699,12 +698,10 @@ function snakeAIsurvival(){
|
||||
score -= distance;
|
||||
}
|
||||
|
||||
// avoid tunnels
|
||||
if (freeNeighbors <= 1){
|
||||
score -= 100;
|
||||
}
|
||||
|
||||
// slight randomness
|
||||
score += random(-3, 3);
|
||||
|
||||
if (score > bestScore){
|
||||
|
||||
Reference in New Issue
Block a user