diff --git a/src/lib/moveTowardsEnemy.ts b/src/lib/moveTowardsEnemy.ts index a39ec9a..a7c0495 100644 --- a/src/lib/moveTowardsEnemy.ts +++ b/src/lib/moveTowardsEnemy.ts @@ -4,7 +4,7 @@ import { closestEnemyHead } from './closestEnemyHead'; export function moveTowardsEnemy(data: BTData) { const closest = closestEnemyHead(data); - if (closest.direction) { + if (closest && closest.direction) { log('moveTowardsEnemy', closest.direction); return closest.direction; } diff --git a/src/server/snakes/tail-chase.ts b/src/server/snakes/tail-chase.ts index 2b130b1..850d0aa 100644 --- a/src/server/snakes/tail-chase.ts +++ b/src/server/snakes/tail-chase.ts @@ -26,7 +26,6 @@ export class TailChase extends BaseSnake implements ISnake { } const closest = closestEnemyHead(data); - console.log(closest); if (closest && closest.path.length <= 4) { direction = moveAway(data); }