Skip to content
Permalink
Browse files

tail, free, food

  • Loading branch information...
kssilveira committed Mar 9, 2019
1 parent f133242 commit d949d02ae0ae0cb3205c801fe2d7432ddf561706
Showing with 5 additions and 2 deletions.
  1. +5 −2 app/main.py
@@ -61,6 +61,7 @@ def start():
}

NO_DISTANCE = -1
NO_MOVE = '?'

class Game(object):

@@ -93,7 +94,7 @@ def adjacent(self, x, y):

def distances(self, x, y):
res = [[NO_DISTANCE for _ in range(self.width)] for _ in range(self.height)]
move = [['?' for _ in range(self.width)] for _ in range(self.height)]
move = [[NO_MOVE for _ in range(self.width)] for _ in range(self.height)]
# Flood fill.
res[y][x] = 0
deque = collections.deque()
@@ -172,7 +173,9 @@ def move():
# pprint.pprint(moves)

direction = game.move_to_tail(moves)
if False and game.health <= 50:
if direction == NO_MOVE:
direction = game.move_to_free()
if game.health <= 50:
direction = game.move_to_food(distances, moves)
return move_response(direction)

0 comments on commit d949d02

Please sign in to comment.
You can’t perform that action at this time.