<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def update(self, deltat=1.0):
        '''fly a square circuit'''
        DNFZ.update(self, deltat)
        self.dist_flown += self.speed * deltat
        if self.dist_flown > self.circuit_width:
            self.desired_heading = self.heading + 90
            self.dist_flown = 0
        if self.getalt() < self.ground_height() or self.getalt() > self.ground_height() + 2000:
            self.randpos()
            self.randalt()