dumb_scouter.py 791 B

123456789101112131415161718192021222324252627282930
  1. import random
  2. from board import Board
  3. class DumbScouter:
  4. """ Dumb scouter searching food randomly and without any knowledge """
  5. def __init__(self, board, knowledge, x, y, drop_value):
  6. """
  7. :type board: Board
  8. :type knowledge: dict
  9. :type x: int
  10. :type y: int
  11. :type drop_value: float
  12. """
  13. self.board = board
  14. self.knowledge = knowledge
  15. self.x = x
  16. self.y = y
  17. self.drop_value = drop_value
  18. def move(self):
  19. x = self.x + random.randint(-1, 1)
  20. y = self.y + random.randint(-1, 1)
  21. if self.board.inside(x, y):
  22. self.x = x
  23. self.y = y
  24. def update(self):
  25. self.board.update_blob(self.x, self.y, self.drop_value)