def ride(soName="bird1", t=60.0): #recuperer tous les joueurs playerList = PtGetPlayerList() playerList.append(PtGetLocalPlayer()) for player in playerList: playerName = player.getPlayerName() Ride.Suivre(objet=soName, Avatar=playerName, duree=t) CercleV(coef=2.0, avCentre=None)
def ride(soName="sandscrit", t=30.0, c=None): #recuperer tous les joueurs playerList = PtGetPlayerList() playerList.append(PtGetLocalPlayer()) for player in playerList: playerName = player.getPlayerName() Ride.Suivre(objet=soName, Avatar=playerName, duree=t) if c is not None: PtSetAlarm(2, CircleAlarm(), c)
def readfile(self): with open(self.file, 'r') as file: line1 = file.readline() line1Vec = line1.strip().split() ridesList = [] n = 0 for txt in file: ls = txt.strip().split() ride = Ride.Ride(n, [int(ls[0]),int(ls[1])], [int(ls[2]), int(ls[3])], int(ls[4]), int(ls[5])) ridesList = ridesList + [ride] n = n + 1 return ridesList, int(line1Vec[0]), int(line1Vec[1]), int(line1Vec[2]),int(line1Vec[3]), int(line1Vec[4]), int(line1Vec[5])
def inputFileToProblem(pb: Problem) -> None: with open(file) as f: nbRows, nbCols, nbVehicules, nbRides, bonus, maximumTime = f.readline( ).split() rides = [] for line in f: print(line) a, b, x, y, s, fin = line.split() startPoint = Point.Point(a, b) finishPoint = Point.Point(x, y) rides.append(Ride(startPoint, finishPoint, s, fin)) map = Map(nbRows, nbCols) return Problem(map, nbVehicules, rides, maximumTime)
def __init__(self, path): self.nb_cars = 0 self.nb_steps = 0 self.cars = [] self.rides = [] file = open(path) lines = file.readlines() first_line = lines[0].split() self.nb_cars = int(first_line[2]) self.nb_steps = int(first_line[5]) for i in range(0, self.nb_cars): self.cars.append(Car()) for line in range(1, len(lines)): self.rides.append(Ride(lines[line], line - 1))
def ride(soName="oiseaut1", t=60.0): #recuperer tous les joueurs playerList = PtGetPlayerList() playerList.append(PtGetLocalPlayer()) for player in playerList: """ objKey = PtGetAvatarKeyFromClientID(player.getPlayerID()) soavatar = objKey.getSceneObject() #faire flotter tout le monde soavatar.physics.enable(0) soavatar.netForce(1) """ # playerName = player.getPlayerName() Ride.Suivre(objet=soName, Avatar=playerName, duree=t)
def createRides(self, listOfString): rideList = [] for i in range(len(listOfString)): ride = Ride(listOfString[i], i) rideList.append(ride) return rideList
def shroomie(act="sur moi"): Ride.Action(animal="shroomie", action=act)
def sandscrit(what='sur moi'): Ride.Action(animal='sandscrit', action=what)
def urwin(what='sur moi'): Ride.Action(animal='urwin', action=what)
def monkey(what='sur moi'): Ride.Action(animal='singe', action=what)
fichier = open(filename + ".in", "r") constants = fichier.readline().rstrip().split(' ') rows = int(constants[0]) columns = int(constants[1]) nbVehic = int(constants[2]) nbRides = int(constants[3]) bonus = int(constants[4]) timeMax = int(constants[5]) listRides = [] ridesToDo = [] for k in range(0, nbRides): listRides.append( Ride( list( map(lambda x: int(x), fichier.readline().rstrip().split(' '))), k)) fichier.close() vehicules = [] for k in range(0, nbVehic): vehicules.append(Vehicule()) """ Ici le coeur de l'algo """ # Sorting the list of rides to do by starting time ridesToDo = [ride for ride in listRides] ridesToDo.sort(key=lambda x: x.earlyStart) T = list(range(0, timeMax)) algo(ridesToDo, vehicules, T)