コード例 #1
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials, robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.
    
    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.
    
    Visualization is turned on when boolean VISUALIZE is set to True.
    
    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    
    test case:
    avg = runSimulation(10, 1.0, 15, 20, 0.8, 30, Robot, False)
    
    """
    # TODO: Your code goes here
    
    trialsCollection = []                       # list to hold lists of date from each trial
    for m in range(num_trials):               # for each trial
        # print "Trial %i:" % m,
        if visualize: anim = ps11_visualize.RobotVisualization(num_robots, width, height, .02)
        # create the room
        testRoom = RectangularRoom(width, height)
        
        # create robots and put them in a list
        robotList = []
        for i in range(num_robots):
            robotList.append(robot_type(testRoom, speed))
        
        # initialize for this trial
        percentClean = 0.0000000
        progressList = []
        
        while percentClean < min_coverage:     # clean until percent clean >= min coverage
            if visualize: anim.update(testRoom, robotList)
            for eachRobot in robotList:             # for each time-step make each robot clean
                eachRobot.updatePositionAndClean()
            percentClean = float(testRoom.getNumCleanedTiles()) / float(testRoom.getNumTiles())
            progressList.append(percentClean)
        if visualize: anim.done()
        trialsCollection.append(progressList)
        
        # print "%i robot(s) took %i clock-ticks to clean %i %% of a %ix%i room." %(num_robots, len(progressList), int(min_coverage * 100), width, height)
    averageOfTrials = calcAvgLengthList(trialsCollection)
    # print "On average, the %i robot(s) took %i clock ticks to %f clean a %i x %i room." %(num_robots, int(averageOfTrials), min_coverage, width, height)
    return trialsCollection
コード例 #2
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    um_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    trialsList = []
    for trial in range(num_trials):
        if visualize:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height)
        trialsList.append([])  #append a list to hold the results of this trial
        currentRoom = RectangularRoom(width,
                                      height)  #make a new room for each trial
        roboList = []
        for botNum in range(num_robots):  #make the right number of robots
            roboList.append(robot_type(
                currentRoom, speed))  #all of the bots clean the same room
        #  print "making Robot: ",  botNum
        time = 0
        while float(currentRoom.getNumCleanedTiles()) / float(
                currentRoom.getNumTiles(
                )) < min_coverage:  #true if the min coverage is not clean
            if visualize:
                anim.update(currentRoom, roboList)
            #print "in the while loop and clean portion is: ",  float(currentRoom.getNumCleanedTiles())/float(currentRoom.getNumTiles())
            trialsList[trial].append(
                float(currentRoom.getNumCleanedTiles()) /
                float(currentRoom.getNumTiles()))
            for bot in roboList:  #hey all you robots...
                #get hungrier...
                bot.setRobotHunger(-1)
                #   if bot.getRobotHunger < 1:

                bot.updatePositionAndClean(
                )  #... clean the floor, stupid minions!
        if visualize:
            anim.done()
    return trialsList
コード例 #3
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    anim = 0
    if visualize:
        anim = ps11_visualize.RobotVisualization(num_robots, width, height)
    room = RectangularRoom(width, height)

    robots = []
    for robo in xrange(num_robots):
        robot = robot_type(room, speed)
        robots.append(robot)

    result_code = []
    for time in xrange(num_trials):
        for robot in robots:
            robot.updatePositionAndClean()

        if visualize:
            anim.update(room, robots)

        totalTile = room.getNumTiles()
        cleanedTile = room.getNumCleanedTiles()
        percent = cleanedTile / 1.0 / totalTile
        result_code.append(percent)
        if percent > min_coverage:
            break

    if visualize:
        anim.done()

    return result_code
コード例 #4
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    # TODO: Your code goes here
    cleanList = []
    for trial in range(num_trials):
        if visualize: anim = ps11_visualize.RobotVisualization(num_robots, width, height)
        cleanListPerBot = []
        
        robots = []

        #create a room
        room = RectangularRoom(width, height)

        #create a list of robots
        for robotNum in range(num_robots):
            robots.append(robot_type(room, speed))

        percentClean = 0.0
        
        #for each trial, compute list of percentage of room it cleans at each clock tick
        while percentClean <= min_coverage:
            if visualize: anim.update(room, robots)
            for robot in robots:
                robot.updatePositionAndClean()
                percentClean = float(room.getNumCleanedTiles()) / float(room.getNumTiles())
                if percentClean > min_coverage:
                    break;
                cleanListPerBot.append(percentClean)
        cleanList.append(cleanListPerBot)
        if visualize: anim.done()
    return cleanList
コード例 #5
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    
    for test in range(num_trials):
    
        if visualize:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height) 
            
        trial_list = []
        trial = []
        room = RectangularRoom(width, height)
        robot_list = [robot_type(room, speed) for i in range(num_robots)]
        cleaned_percentage = 0.0
        
        while cleaned_percentage < min_coverage:
            for robot in robot_list:
                
                robot.updatePositionAndClean()
                if visualize:
                    anim.update(room, robot_list) 
                    
               
                cleaned_percentage = float(room.getNumCleanedTiles())/float(room.getNumTiles())
                trial.append(cleaned_percentage)    
        if visualize:
            anim.done() 
            
        trial_list.append(trial)
        
    return trial_list
コード例 #6
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    trial_list = []
    for trial in range(1, num_trials + 1):
        percentage_cleaned = 0
        room = RectangularRoom(width, height)
        robots = []
        time_step_list = [(0,0)]
        time_step = 0 
        for robot_id in range(0,num_robots):
            # Initialize robots           
            robots.append(robot_type(room, speed))
            robots[robot_id].pos = room.getRandomPosition()
        if visualize:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height) 
        while percentage_cleaned < min_coverage:
            time_step = time_step + 1
            for robot_id in range(0,num_robots):
                robots[robot_id].updatePositionAndClean()
            percentage_cleaned = room.getNumCleanedTiles()/room.getNumTiles()
            time_step_list.append((time_step, percentage_cleaned))
            if visualize:
                anim.update(room, robots)
        trial_list.append(time_step_list)
        
        if visualize:
            anim.done()          
    return trial_list
コード例 #7
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    # TODO: Your code goes here

    result = list()
    for trial in range(num_trials):
        if visualize:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height)
        room = RectangularRoom(width, height)
        coverage = list()
        list_of_robots = list()
        for each in range(num_robots):
            list_of_robots.append(robot_type(room, speed))
        while room.getCoverage() < min_coverage:
            if visualize: anim.update(room, list_of_robots)
            coverage.append(room.getCoverage())
            for each in list_of_robots:
                each.updatePositionAndClean()
        result.append(coverage)
        if visualize: anim.done()
    return result
コード例 #8
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    lol = []

    for i in range(num_trials):
        lol.append([])  #;print lol
        room = RectangularRoom(width, height)
        bots = [robot_type(room, speed) for k in range(num_robots)]
        percentage_cleaned = 0
        if visualize == True:
            anim = viz.RobotVisualization(num_robots, width, height)
        while (percentage_cleaned < min_coverage):
            for j in range(num_robots):
                bots[j].updatePositionAndClean()
            percentage_cleaned = float(
                room.getNumCleanedTiles()) / room.getNumTiles()
            lol[i].append(percentage_cleaned)
            if visualize == True: anim.update(room, bots)
    if visualize == True: anim.done()
    return lol
コード例 #9
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """

    listToBeReturned = []

    listForEachTrial = []

    robots = []

    room = RectangularRoom(width,height)

    cleanedRatio = 0

    for i in range(num_robots):
        a = robot_type(room,speed)
        robots.append(a)

    for i in range(num_trials):

        if visualize:
            anim = ps11_visualize.RobotVisualization(num_robots,width, height,0.01)

        epsilon = 0.01

        while abs(cleanedRatio-min_coverage) > epsilon:
                
            for i in range(num_robots):
                robots[i].updatePositionAndClean()            

            cleanedRatio = room.getNumCleanedTiles() / room.getNumTiles()

            print 'amount of room cleaned till now:',cleanedRatio*100,'%'

            listForEachTrial.append(cleanedRatio * 100)

            if visualize:
                anim.update(room, robots)

        if visualize:
            anim.done()

        listToBeReturned.append(listForEachTrial)

    return listToBeReturned
コード例 #10
0
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """

    listForAllTrials = []

    if visualize:

        anim = ps11_visualize.RobotVisualization(num_robots, width, height)

    for i in range(num_trials):

        ##intiating the room and the robots

        room = RectangularRoom(width, height)

        robots = []  ##The list that contains all the robots

        for i in range(num_robots):

            robots.append(robot_type(room, speed))

        ##runs num_trials trials of the simulation

        listForThisTrial = []

        areaCovered = 0

        epsilon = 0.001

        while areaCovered < min_coverage:

            for i in range(len(robots)):

                robots[i].updatePositionAndClean()

            if visualize:

                anim.update(room, robots)

            areaCovered = room.getNumCleanedTiles() / float(room.getNumTiles())

            listForThisTrial.append(areaCovered)

        if visualize:

            anim.done()

        listForAllTrials.append(listForThisTrial)

    return listForAllTrials
コード例 #11
0
ファイル: ps11.py プロジェクト: FrankDawin/MIT-6.00
def runSimulation(num_robots,
                  speed,
                  width,
                  height,
                  min_coverage,
                  num_trials,
                  robot_type,
                  visualize=False):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """

    result = []

    for y in range(num_trials):

        switch = True

        the_room = RectangularRoom(width, height)
        robot_list = []
        ticks = 0

        for t in range(num_robots):
            robot_list.append(robot_type(the_room, speed))

        if visualize == True:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height)

        while switch == True:

            ticks += 1

            if visualize == True:
                anim.update(the_room, robot_list)

            if min_coverage <= the_room.get_coverage():
                if visualize == True:
                    anim.done()
                result.append([ticks])
                switch = False

            else:
                for i in robot_list:
                    i.updatePositionAndClean()

    return result
コード例 #12
0
ファイル: ps11.py プロジェクト: CStage/MIT-Git
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, go):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    # TODO: Your code goes here
    total_steps=0
    AcceptedInput=False
    if go==True:
        AcceptedInput=True
        visualize=True
    if go==False:
        AcceptedInput=True
        visualize=False
    else:
        print("Do you want visualization?")
    while AcceptedInput==False:
        input1=input("Y/N: ")
        print(input1)
        if str(input1)=="N" or str(input1)=="n":
            visualize=False
            AcceptedInput=True
        if str(input1)=="Y" or str(input1)=="y":
            visualize=True
            AcceptedInput=True
        else:
            print("Invalid output")
#    if not 0<=min_coverage<=1.00000000000:
#        raise ValueError
    min_coverage=float(min_coverage)

    trialscollection=[]
    for m in range(num_trials):
        if visualize:
            anim=ps11_visualize.RobotVisualization(num_robots, width, height,)
        testRoom=RectangularRoom(width, height)

        robotList=[]
        for i in range(num_robots):
            robotList.append(robot_type(testRoom, speed))
        percentClean=0.0000000000
        progressList=[]
#        print("First percentClean", percentClean)
        while float(percentClean)<float(min_coverage):
            if visualize:
                anim.update(testRoom, robotList)
            for each in robotList:
                each.updatePositionAndClean()
#            print("cleantiles", testRoom.cleanTiles)
            percentClean=testRoom.getNumCleanedTiles()/testRoom.getNumTiles()
#            print("getNumCleanedTiles", testRoom.getNumCleanedTiles())
#            print("percentClean", percentClean, "MIN_COVERAGE", min_coverage)
            progressList.append(percentClean)
            total_steps+=speed
#            print("Coverage", percentClean)
#        print("are all tiles clean?")
#        for i in range(testRoom.width):
#            for j in range(testRoom.height):
#                print((i,j), testRoom.isTileCleaned(i,j))
        if visualize:
            anim.done()
        trialscollection.append(progressList)
#    averageOfTrials = calcAvgLengthList(trialscollection)

#    print("Total steps", total_steps)
#    print("min_coverage", min_coverage)
#    print("trialscollection", trialscollection)
    return trialscollection
コード例 #13
0
ファイル: ps11.py プロジェクト: binyuace/CS-6_001-Solution
def runSimulation(num_robots, speed, width, height, min_coverage, num_trials,
                  robot_type, visualize):
    """
    Runs NUM_TRIALS trials of the simulation and returns a list of
    lists, one per trial. The list for a trial has an element for each
    timestep of that trial, the value of which is the percentage of
    the room that is clean after that timestep. Each trial stops when
    MIN_COVERAGE of the room is clean.

    The simulation is run with NUM_ROBOTS robots of type ROBOT_TYPE,
    each with speed SPEED, in a room of dimensions WIDTH x HEIGHT.

    Visualization is turned on when boolean VISUALIZE is set to True.

    num_robots: an int (num_robots > 0)
    speed: a float (speed > 0)
    width: an int (width > 0)
    height: an int (height > 0)
    min_coverage: a float (0 <= min_coverage <= 1.0)
    num_trials: an int (num_trials > 0)
    robot_type: class of robot to be instantiated (e.g. Robot or
                RandomWalkRobot)
    visualize: a boolean (True to turn on visualization)
    """
    # TODO: Your code goes here
    

    
#    for robot in listofrobots:
#        robot.setRobotPosition(theroom.getRandomPosition())
#    for robots in listofrobots:
#                assert type(robots) == Robot
#                robots.updatePositionAndClean()
#    anim.update(theroom, listofrobots)
                
    
    count =0
    while num_trials > count:
        listoflists = []
        theroom = RectangularRoom(width,height)
        listofrobots=[]
        for i in range(num_robots):
            listofrobots.append(robot_type(theroom,speed))
        lists = []
        coverage = 0
        if visualize == True:
            anim = ps11_visualize.RobotVisualization(num_robots, width, height)
        for robot in listofrobots:
            robot.setRobotPosition(theroom.getRandomPosition())
        while coverage < min_coverage:
            for robots in listofrobots:
                robots.updatePositionAndClean()
            if visualize == True:
                anim.update(theroom, listofrobots)
            coverage = float(theroom.getNumCleanedTiles())/theroom.getNumTiles()
            lists.append(coverage)
            
        
        
        
        
        
        count += 1
        listoflists.append(lists)
    if visualize == True:
        anim.done()
    return listoflists