class Miner(BaseEntity):
    """Miner Bob.
    
    Note: The constructor doesn't take any actual args, but this syntax is
    needed to call the __init__ method of the superclass. I'm not sure that
    we need to do so here, but it will be a useful reminder for later.    
    """

    def __init__(self, *args):
        super(Miner, self).__init__(*args)
        self.name = "Miner Bob"
        self.location = SHACK
        self.gold = 0
        self.bank = 0
        self.thirst = 0
        self.fatigue = 0

        # Set up the FSM for this entity
        self.fsm = StateMachine(self)
        self.fsm.set_state(STATE_NONE,GlobalMinerState(),None)
        self.fsm.change_state(DigInMine())

    def update(self):
        """Increases thirst and updates the FSM logic."""
        self.thirst += 1
        self.fsm.update()

    def receive_msg(self,message):
        # print("%s: Got me a message of type %d!" % (self.name,msg_type))
        # Let the FSM handle any messages
        self.fsm.handle_msg(message)

    def change_location(self,newlocation):
        """Move to another location
        
        Location constants are enumerated in gamedata.py
        """
        self.location = newlocation

    def change_gold(self,amount):
        """Add/subtract the amount of gold currently carried
        
        Parameters
        ----------
        amount: int
            Amount of gold to add (or subtract, if negative)
        """
        self.gold += amount
        #print("[[%s]] : Now carrying %d gold nuggets." % (self.name, self.gold))

    def pockets_full(self):
        """Queries whether this entity is carrying enough gold."""
        return (self.gold >= 3)

    def add_fatigue(self,amount=1):
        """Increases the current fatigue of this entity."""
        self.fatigue += amount
        #print("[[%s]] : Now at fatigue level %d." % (self.name,self.fatigue))

    def remove_fatigue(self,amount=1):
        """Remove fatigue from this entity, but not below zero."""
        self.fatigue -= amount
        if self.fatigue < 0:
            self.fatigue = 0

    def is_thirsty(self):
        """Queries if this entity has too much current thirst."""
        return (self.thirst > 7)

    def remove_thirst(self,amount):
        """Remove thirst from this entity, but not below zero."""
        self.thirst -= amount
        if self.thirst < 0:
            self.thirst = 0

    def work_done(self):
        """Returns True if more than 10 gold in the bank.
        
        Note
        ----
        Fix this! Once there is 10 gold or more in the bank, the Miner
        will go home after each bank deposit. We don't want that.
        """              
        return (self.bank >= 10)