time = ( p.xLimit * p.yLimit ) * .25 #time unit for this algorithm. If needed, comment this and uncomment the next to test different times #time=500 visitedCoordinates = [ ] #Holds the coordinates we have already been to so we dont go over them more than once. wallCoordinates = [ ] #Holds the coordinates of the walls. Not counting the outer walls. traverse = [ ] #traverse holds the coordinates to help manuever around walls wallFound = False #Holds whether or not we have run into a wall. found = False #If the location is found, we will make this true. while count <= time: if found != True: wallFound = False visitedCoordinates = [robot.GetLocation()] if algorithmChoice == 5: currentEndpoint = bestCrop elif algorithmChoice == 1: currentEndpoint = highestPercentLocation prevCoord = ( 0, 0) #Holds previous coordinate in order to check for while robot.GetLocation( ) != currentEndpoint and count <= time: #move the robot until you hit the location or time runs out if prevCoord == robot.GetLocation(): visitedCoordinates = [robot.GetLocation()] prevCoord = robot.GetLocation() p.UpdatePlot() #Update the plot #The following if statements check for walls in each direction and determines if it has been visited or not. #This will determine which direction the robot will move until it hits a wall.