import random, math
from drawing import draw
from utilities import *

class Agent():
    def __init__(self,board,x,y):
        #do not overwrite this function
        self.board=board
        self.sizes=(self.board.width,self.board.height)
        self.char="?"
        self.logger=get_logger()
        self.position=[x,y]
        self.initialize()

    def initialize(self):
        pass

    def set_random_position(self):
        x=random.randint(0,self.board.width)
        y=random.randint(0,self.board.height)
        self.position=[x,y]

    def tick(self):
        #return true if the agent moved
        pass

    def clamp_to_board(self):
        for j in range(2):
            if self.position[j]<=0:
                self.velocity[j]=0
                self.position[j]=1
            if self.position[j]>=self.sizes[j]:
                self.velocity[j]*=0
                self.position[j]=self.sizes[j]-1
