def mainGenerate(): '''Perform a full generation run, from array, png to world creation''' #Generate the world and tree world, root = generateWorld() #Create the bases from the world and the tree world, bases = createBases(world, root) #Create the robots from the bases robots = addRobots(bases) #Convert the bases to world space baseBlocks = createBaseBlocks(bases) #Convert the robot positions to world space robotPositions = convertRobotsToWorld(robots) #Create a list of obstacles obstacles = generateObstacles() #Output the world as a picture printWorld(world, "") #Generate the wall parts for the tree generateWallParts(root, world) #Generate the edges of the map to mark as used used = generateEdges(world) #Calculate all the wall blocks for the tree (exclude used pixels) walls, used = createAllWallBlocks(root, used) #Make a map from the walls WorldCreator.makeFile(walls, baseBlocks, obstacles, robotPositions) #Print to indicate the program completed properly print("Generation Successful")
def generateWorldFile(world, obstacles, startPos, window): #Array of wall tiles walls = [] #Iterate vertically for y in range(0, len(world) + 1): #Create a row row = [] #Iterate horizontally for x in range(0, len(world[0]) + 1): #Add each tile [present, [uWall,rWall,dWall,lWall], checkpoint, trap, goal, swamp, humanType, humanWall] row.append([ False, [False, False, False, False], False, False, False, False, 0, 0 ]) #Add row to array walls.append(row) #Iterate for each of the tiles for y in range(0, len(world)): for x in range(0, len(world[0])): #If there is a tile there if world[y][x] != None: #Get the human data humanInfo = world[y][x].getHumanData() #Add the wall data walls[y][x] = [ True, world[y][x].getWalls(), world[y][x].getCheckpoint(), world[y][x].getTrap(), world[y][x].getGoal(), world[y][x].getSwamp(), humanInfo[0], humanInfo[1] ] #Make a map from the walls and objects WorldCreator.makeFile(walls, obstacles, startPos, window)
def generateWorldFile (world, root, baseBlocks, obstacles, robotPositons, numHumans, numChildren, activities, bounds, doors, window): #Generate the wall parts for the tree generateWallParts(root, world) #Generate the edges of the map to mark as used used = generateEdges(world) #Calculate all the wall blocks for the tree (exclude used pixels) walls, used = createAllWallBlocks(root, used) #Convert the bounds positions to world space bounds = convertBoundsToWorld(bounds) doors = convertDoorsToWorld(doors, bounds) #Make a map from the walls and objects WorldCreator.makeFile(walls, baseBlocks, obstacles, robotPositions, numHumans, numChildren, activities, bounds, doors, window)