snake: add snake, but ignore when counting length left
This commit is contained in:
parent
f59e7cf747
commit
b6fe678367
@ -214,6 +214,7 @@ class Bot {
|
||||
continue;
|
||||
if (isBitSet(g_snake.board[location.y][location.x], BoardState.SNAKE)) {
|
||||
reachedSnake = true;
|
||||
this.path.push(location);
|
||||
continue;
|
||||
}
|
||||
var delta = new Point;
|
||||
@ -240,7 +241,7 @@ class Bot {
|
||||
*/
|
||||
nextMove() {
|
||||
// Get new path to food
|
||||
if (this.path.length !== 0)
|
||||
if (this.path.length === 1)
|
||||
this.pathRefresh();
|
||||
var next: Point = new Point;
|
||||
next.copy(this.path.pop());
|
||||
|
Loading…
Reference in New Issue
Block a user