def display(self): """ B _________ A wheels : four small rectangles w on the sides of the rectangle | | coordinates : w1x, w1y, w2x, w2y, ... | O | |_________| C D """ coords_body = rectangle_vertices(self.x, self.y, width=self.width, length=self.length, angle=self.heading) w1x, w1y = rotate(self.x + self.length/4, self.y - self.width/2, self.heading, self.x, self.y) # front left w2x, w2y = rotate(self.x - self.length/3.1, self.y - self.width/2, self.heading, self.x, self.y) # back left w3x, w3y = rotate(self.x + self.length/4, self.y + self.width/2, self.heading, self.x, self.y) # front right w4x, w4y = rotate(self.x - self.length/3.1, self.y + self.width/2, self.heading, self.x, self.y) # back right fwar = self.turning * 10 # front wheels additional rotation (if car is turning) coords_wheel_1 = rectangle_vertices(w1x, w1y, width=self.width/4, length=self.length/4, angle=self.heading+fwar) coords_wheel_2 = rectangle_vertices(w2x, w2y, width=self.width/4, length=self.length/4, angle=self.heading) coords_wheel_3 = rectangle_vertices(w3x, w3y, width=self.width/4, length=self.length/4, angle=self.heading+fwar) coords_wheel_4 = rectangle_vertices(w4x, w4y, width=self.width/4, length=self.length/4, angle=self.heading) world.create_polygon(coords_body, fill=self.color, outline='black', width=2, tag=self.name) world.create_polygon(coords_wheel_1, fill='black', tag=self.name + "_wfl") world.create_polygon(coords_wheel_2, fill='black', tag=self.name + "_wbl") world.create_polygon(coords_wheel_3, fill='black', tag=self.name + "_wfr") world.create_polygon(coords_wheel_4, fill='black', tag=self.name + "_wbr") world.pack()
def move_current_player(self, n_player): current = self.players[n_player] prev_pos = current.x, current.y start = time.time() current.update_position() end = time.time() duration = end - start data[n_player + 1]['Total'] += duration data[n_player + 1]['Counter'] += 1 new_pos = current.x, current.y board_center = self.board.m // 2, self.board.n // 2 rotations = 1 i = (n_player + 1) % self.n_players while i != n_player: p = self.players[i] prev_pos_p = rotate(prev_pos[0], prev_pos[1], -rotations * 90, board_center) new_pos_p = rotate(new_pos[0], new_pos[1], -rotations * 90, board_center) p.update_view(prev_pos_p, new_pos_p) i = (i + 1) % self.n_players rotations = rotations + 1
def draw(self): x, y = functions.convert(self.body.position) if self.thrusting: self.imageIndex += 0.5 self.screen.blit(self.sheetThrust[int(self.imageIndex % 4)], (x - 100, y - 120)) functions.rotate(self.screen, self.armImg, (x - 4, y - 24), (96, 96), -math.degrees(self.target.currAngle)) else: self.imageIndex += 0.25 self.screen.blit(self.sheetIdle[int(self.imageIndex % 2)], (x - 100, y - 120)) functions.rotate(self.screen, self.armImg, (x - 4, y - 24), (96, 96), -math.degrees(self.target.currAngle)) self.screen.blit(self.shldrImg, (x - 100, y - 120))
def standard_hough_rotation(theta, drawing_image): # rotation_angle = ((math.cos(theta) * 180) / math.pi) * -1 # rotation_angle = (90 - math.degrees(theta)) * -1 rotation_angle = (90 - math.degrees(theta)) * -1 rotated_image = functions.rotate(drawing_image, rotation_angle) print "most common theta is: " + str(theta) print "rotation angle is: " + str(rotation_angle) functions.plot_images([image, drawing_image, rotated_image], ["input image", "Std. Hough", "Rotated"])
def re(self,text): global img global flag if flag: img=colour_effect.rotated(img,int(functions.rotate())) img.save("trash.jpg") self.show_picture('trash.jpg') else: mt=easygui.msgbox('You do not insert any file, please open a file and try again','Detail',' ok ')
def move(self, player): if not self.moving: # set the animation to motionless self.imageIndex = 0 # watch the player self.targetX = player.x self.targetY = player.y self.targetDirection = pointDirection(self.x, self.y, self.targetX, self.targetY) # count down the wait timer self.waitTimer -= 1 if self.waitTimer == 0: # False is telling the spider NOT to get off the screen self.decisionMaker(False, player.x, player.y) else: # update sprite as the spider moves self.spriteCounter += 1 if self.spriteCounter > 2: self.spriteCounter = 0 self.imageIndex = (self.imageIndex + 1) % len(self.spriteIndex) # get the distance between the spider and the target point testDistance = pointDistance(self.x, self.y, self.targetX, self.targetY) # no need to do a for loop test until the spider is close enough to the target if testDistance < self.spiderSpeed * 2: tempX = self.add_x / testDistance tempY = self.add_y / testDistance # now do a pixel by pixel test and once close enough then stop. 3.5 is close enough to stop the spider for f in range(int(testDistance)): if math.fabs(self.x + tempX * f - self.targetX) < 3.5 and math.fabs(self.y + tempY * f - self.targetY) < 3: self.add_x = tempX * f self.add_y = tempY * f self.moving = False break self.x += self.add_x self.y += self.add_y """ # A FAIL SAFE CATCH FOR WHEN THE SPIDER WANDERS OFF THE SCREEN, BUT DOESN'T KNOW HE'S F*****G LOST if math.fabs(self.x) > self.screenWidth * 3 or math.fabs(self.y) > self.screenHeight * 3: self.moving = False""" self.spriteEye = rotate(self.spriteEyeStart, self.targetDirection).convert_alpha() self.spriteEyeCentre = matchCentre(self.spriteEyeStart, self.spriteEye) eyeRect = self.spriteEye.get_rect() self.spriteEyeSmall = pygame.transform.smoothscale(self.spriteEye, (eyeRect.width / 2, eyeRect.height / 2)).convert_alpha() # no convert_alpha() needed here. the self.mask is taken from another sprite in __init__ self.sprite = pygame.image.load(self.spriteIndex[self.imageIndex]).convert_alpha() self.spriteArea = pygame.Rect(self.x, self.y, self.width, self.height)
def Homologation(ser,team): functions.set_speed(ser,0.2) functions.set_speed(ser,1) functions.open_bras(ser) functions.move_pos(ser,0.85,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0.4,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,team*1.5708) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0.4,team*0.45) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) while answer !='$END9;': functions.move_pos(ser,1.1,team*0.45) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0.2,team*0.45) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser)
def closest_point(car, track, angle): """return the approximate coordinates of the closest point to the car along the direction given by theta (relative to the car's heading)""" x_inf, y_inf = car.x, car.y if not is_out(track, car): t = 100 x, y = rotate(car.x + t, car.y, car.heading + angle, car.x, car.y) while not is_out(track, x=x, y=y): t *= 2 x, y = rotate(car.x + t, car.y, car.heading + angle, car.x, car.y) epsilon = 10 while epsilon > 5: x_tmp, y_tmp = (x + x_inf) / 2, (y + y_inf) / 2 if not is_out(track, x=x_tmp, y=y_tmp): x_inf, y_inf = x_tmp, y_tmp else: x, y = x_tmp, y_tmp epsilon = distance(x, y, x_inf, y_inf) else: t = 5 x, y = rotate(car.x + t, car.y, car.heading + angle, car.x, car.y) while is_out(track, x=x, y=y) and t < 300: t += 25 x, y = rotate(car.x + t, car.y, car.heading + angle, car.x, car.y) epsilon = 10 while epsilon > 5: x_tmp, y_tmp = (x + x_inf) / 2, (y + y_inf) / 2 if is_out(track, x=x_tmp, y=y_tmp): x_inf, y_inf = x_tmp, y_tmp else: x, y = x_tmp, y_tmp epsilon = distance(x, y, x_inf, y_inf) return x, y
def get_absolute_pos(self, relative_pos, n_player): if n_player < 1 or n_player > 4: raise ValueError( 'player number must be at least 1 and not greater than 4') rotations = n_player - 1 board_center = self.m // 2, self.n // 2 x, y = rotate(relative_pos[0], relative_pos[1], 90 * rotations, board_center) return x, y
def prob_hough_rotation(image, drawing_image): lines, drawn_image = prob_hough(image, drawing_image) radians = dict() for line in lines: pt1, pt2 = line x1, y1 = pt1 x2, y2 = pt2 radian = round(calculate_radians((x1, y1), (x2, y2)), 2) if radian in radians.keys(): radians[radian] = radians[radian] + 1 else: radians[radian] = 1 freq_radian = max(radians, key=radians.get) # rotation_angle = (90 - math.degrees(freq_radian)) * -1 rotation_angle = math.degrees(freq_radian) print("Most frequent radians is: " + str(freq_radian) + "Rotation angle is: " + str(rotation_angle)) rotated_image = functions.rotate(drawn_image.copy(), rotation_angle) # functions.plot_images([image, drawn_image, rotated_image], ["Input image", "HoughLinesP", "Rotated"]) return rotated_image
def move(self, x, y, direction): self.spriteCounter += 1 if self.spriteCounter > 6: self.spriteCounter = 0 self.imageIndex = (self.imageIndex + 1) % 2 self.spriteStart = pygame.image.load(self.spriteIndex[self.imageIndex]).convert_alpha() self.direction = direction self.sprite = rotate(self.spriteStart, self.direction).convert_alpha() self.spriteCentre = matchCentre(self.spriteStart, self.sprite) self.mask = pygame.mask.from_surface(self.sprite) self.x = x# - self.spriteCentre.width / 2 self.y = y# - self.spriteCentre.height / 2 # spriteArea will be used for collision testing self.spriteArea = pygame.Rect(self.x, self.y, self.spriteCentre.width, self.spriteCentre.height)
def change_in_momentum(momentum_in, axis_of_rotation, two_theta): """Finds the change in momentum vector given momentum in, the axis of functions and the two theta angle Args: momentum_in: The momentum vector of the incident beam. Units keV/c. axis_of_rotion: The axis perpendicular to the difraction plane centred on the sample. two_theta: The two_theta angle of difraction. Angle must be passed in degrees. Returns: change_in_momentum: The change in momentum vector. """ _quaternion = r.rotation_to_quaternion(axis_of_rotation, two_theta) momentum_out = r.rotate(momentum_in, _quaternion) return momentum_out - momentum_in
def move(self, playerX, playerY, mushrooms, createMushroom): # do the watching eye eyeDirection = pointDirection(self.x, self.y, playerX, playerY) self.spriteEye = rotate(self.spriteEyeStart, eyeDirection).convert_alpha() self.spriteEyeCentre = matchCentre(self.spriteEyeStart, self.spriteEye) # just moves straight down the screen self.y += 4 if self.y > self.OFF_SCREEN: self.destroyed = True self.spriteArea = pygame.Rect(self.x, self.y, self.width, self.height) if (createMushroom and randint(0, 100) == 0 and placeEmpty(mushrooms, self.x, self.y) and self.y < self.OFF_SCREEN - self.height): self.soundPlop.play() mushrooms.append(Mushroom(self.x, self.y)) # update the body sprite self.spriteCounter += 1 if self.spriteCounter > 2: self.spriteCounter = 0 self.imageIndex = (self.imageIndex + 1) % len(self.spriteIndex) self.sprite = pygame.image.load(self.spriteIndex[self.imageIndex]).convert_alpha()
answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0,1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) k = k+1 functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0.5,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ser.close()
def Prise_Coquillages_2(ser,team,configuration): ### LA CONFIGURATION 1 A UNE SEULE PRISE DE COQUILLAGES ### if configuration==2: ### CONFIGURATION 2 ### ### RECALAGE AVANT DEPART functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_speed(ser,-0.1,0) sleep(0.3) functions.set_x(ser,0) functions.set_t(ser,0) ### On va au fond du board functions.move_push(ser,0.4,team*(-0.8),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.7,team*(-0.82),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,2.2,team*(-0.8),0.25) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### On ramene tout sur le passage functions.move_push(ser,1.6,team*(-0.7),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.6,team*(-0.68),0.15) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.2,team*(-0.6),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### On fait le tour pour tout pousser dans la serviette de depart. functions.move_push(ser,0.4,team*(-0.85),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.07,team*(-0.65),0.05) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.07,team*(0.1),0.15) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) print "Ce sont pas des moules mais on s en contentera ! +12 points potentiels." if configuration==3: ### CONFIGURATION 3 ### functions.move_push(ser,0.5,team*(-0.5),0.15) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.5,team*(-1),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.15,team*(-0.7),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.12,team*(0.05),0.25) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) print "Ce sont pas des moules mais on s en contentera ! +10 points potentiels." elif configuration==4: ### CONFIGURATION 4 A MODIFIER ### functions.move_push(ser,0.35,team*(-0.85),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.9,team*(-0.85),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.1,team*(-0.85),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.3,team*(-0.85),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,team*5) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,180) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.7,team*(-0.85),0) functions.rotate(ser,team*10) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0,0,0.05) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) print "Ce sont pas des moules mais on s en contentera ! +10 points potentiels."
def Prise_Poissons(ser,team): functions.move_push(ser,0.3,team*(-0.88),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### Placement en centre de bassin et deploiement des bras functions.move_push(ser,0.55,team*(-0.90),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.deploy_fish(ser) ### Rotation pour s'aligner avec la mer functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### Changement de vitesse max functions.set_speed(ser,0.2) ### Et 3 pas en avant !! functions.move_pos(ser,0.69,team*(-0.90)) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### Et 3 pas en arriere !! functions.move_pos(ser,0.47,team*(-0.90)) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### RANGEMENT DES BRAS POUR LES AMENER AU FILET functions.moveup_fish_av(ser) functions.moveup_fish_ar(ser) sleep(2) ### DEPLACEMENT VERS LE FILET functions.set_speed(ser,0.5) functions.move_push(ser,0.90,team*(-0.85),0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.1,team*(-0.90),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### LACHEZ LES POISSON !! functions.rlz_fish(ser) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) print "Avouons-le, la peche a la moule c est mieux... +40 points potentiels."
def draw(self): functions.rotate(self.screen, self.parent.gunImg, (self.baseX, self.baseY), (116 / 2, 192 / 2), math.degrees(self.currAngle))
def move(self, SCREEN_WIDTH, SCREEN_HEIGHT, mushrooms, snakes): oldDirection = self.snakeDirection if self.turnTimer > 0: self.turnTimer -= 1 if self.turnTimer == 0: self.snakeDirection = self.snakeTimedTurn #--------------------- DO HEAD SHAKE FIRST --------------------- self.weaveAngle += self.weaving if self.weaveAngle < -10 or self.weaveAngle > 10: self.weaving = -self.weaving #----------------------- UPDATE SPRITE ------------------------- self.spriteSnakeHead = rotate(self.spriteHeadStart, self.snakeDirection + self.weaveAngle).convert_alpha() self.mask = pygame.mask.from_surface(self.spriteSnakeHead) self.spriteCentre = moveCentre(self.spriteHeadStart, self.spriteSnakeHead, 3, self.snakeDirection + self.weaveAngle) #-------------------- UPDATE NEW POSITION --------------------- if self.snakeDirection == 0: self.NEW_X += self.snakeSpeed elif self.snakeDirection == 180: self.NEW_X += -self.snakeSpeed elif self.snakeDirection == 270: self.NEW_Y += self.snakeSpeed elif self.snakeDirection == 90: self.NEW_Y += -self.snakeSpeed if self.turnTimer == 0: hitObject = False testArea = pygame.Rect(self.NEW_X, self.NEW_Y, self.spriteCentre.width, self.spriteCentre.height) for f in range(len(mushrooms)): if testArea.colliderect(mushrooms[f].spriteArea): hitObject = True break """ if not hitObject: tempSnakes = copy.deepcopy(snakes) for f in range(len(snakes)): if self.x == snakes[f].x and self.y == snakes[f].y: tempSnakes = removeElement(tempSnakes, f) break for f in range(len(tempSnakes)): if pygame.Rect(self.NEW_X, self.NEW_Y, self.spriteCentre.width, self.spriteCentre.height ).colliderect(tempSnakes[f].spriteArea): hitObject = True break """ if hitObject: # this will have to do some complicated shit - or maybe not? self.scanAhead(SCREEN_WIDTH, SCREEN_HEIGHT) else: # if not hit a mushroom then do a screen edge test self.screenEdge(SCREEN_WIDTH, SCREEN_HEIGHT) self.x = self.NEW_X self.y = self.NEW_Y # spriteArea will be used for collision testing self.spriteArea = pygame.Rect(self.x, self.y, self.spriteCentre.width, self.spriteCentre.height) # update array of positions self.updatePositionList(self.x, self.y, oldDirection) for f in range(len(self.body)): self.body[f].move(self.positions[self.positionCount * (f + 1)][0], self.positions[self.positionCount * (f + 1)][1], self.positions[self.positionCount * (f + 1)][2])
category_ids = [18, 19] # We will use the mapping from category_id to the class name # to visualize the class label for the bounding box on the image category_id_to_name = {18: 'dog', 19: 'horse'} # 밝기 image_1 = F.brightness(image, 0.5, 3) # 수직 접기 image_2 = F.vertical_flip(image) # 일반 rotate 실행 image_3 = F.rotate2(image, 45) # albumentation rotate 실행 image_4 = F.rotate(image, 45, interpolation=cv2.INTER_LINEAR, border_mode=cv2.BORDER_REFLECT_101, value=None) B.convert('coco', bboxes) bboxes = B.normalize_bboxes(bboxes, rows, cols) print(bboxes, 'bbox5') bboxes2 = copy.deepcopy(bboxes) bboxes3 = copy.deepcopy(bboxes) bboxes4 = copy.deepcopy(bboxes) image5 = F.crop(image, 100, 100, 400, 400) rows, cols = image5.shape[:2] for box in bboxes4: box = F.bbox_crop(box, 100, 100, 400, 400, rows, cols) box = tuple(np.clip(box, 0, 1.0)) # for box in bboxes2: # box[:4] = F.bbox_flip(box, 0, rows, cols)
# --------------------------------- with open(filename, 'w') as outfile: outfile.write('# time %.2f (Myrs ago)\n' % (simulation_age)) outfile.write('#\n') outfile.write( '# X_now Y_now R_now phi_now X_start Y_start R_start phi_start pecu_vel_r pecu_vel_phi\n' ) outfile.write( '# kpc kpc kpc deg kpc kpc kpc deg km/s km/s\n' ) outfile.write('#\n') for X_start, Y_start, R_start, phi_start, pecu_vel_r, pecu_vel_phi in data: # we simulate position of stars in the future by advancing their positions # using rotation curve and pecular velocities of individual stars distG, phi = rotate(simulation_age, R_start * 1000.0, phi_start, pecu_vel_r, pecu_vel_phi) # XY positions evolved to the current time are: xG, yG = project(phi, distG) for row in c_[xG * 0.001, yG * 0.001, distG * 0.001, phi, X_start, Y_start, R_start, phi_start, pecu_vel_r, pecu_vel_phi]: outfile.write( '%9.4f %9.4f %9.4f %9.4f %9.4f %9.4f %9.4f %9.4f %9.2f %9.2f\n' % tuple(row)) if __name__ == '__main__': pass
answer = functions.get_ans(ser) # Demande de l'équipe team = functions.ask_team(ser) # Déplacement functions.move_pos(ser, 0.1, 0) answer = functions.get_ans(ser) while answer != "$DONE;": if (functions.Sicks == 0): functions.move_pos(ser, 0.1, 0) answer = functions.get_ans(ser) # Rotation if team == 'g': functions.rotate(ser, 0.785) else: functions.rotate(ser, 5.495) answer = functions.get_ans(ser) while answer != "$DONE;": if team == 'g': functions.rotate(ser, 0.785) else: functions.rotate(ser, 5.495) answer = functions.get_ans(ser) # Déplacement if team == 'g': functions.move_pos(ser, 0.60, 0.60) else: functions.move_pos(ser, 0.60, -0.60)
def draw(self): functions.rotate(self.screen, self.texture, functions.convert(self.body.position), (9, self.height//2), math.degrees(self.body.angle))
def Prise_Colonne_De_Sable(ser,team,x,y): functions.move_pos(ser,x,team*y) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.enable_US(ser,'0') functions.rotate(ser,team*(-90)) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.enable_pumps(ser) functions.move_speed(ser,-0.2,0) sleep(1) functions.set_speed(ser,0.2) functions.set_speed(ser,1.5) sleep(0.05) functions.enable_US(ser,'9') functions.move_pos(ser,x,team*y-0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.deploy_wings(ser) sleep(1) functions.move_push(ser,0.15,team*(0),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.60,team*(-0.16),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### On s enfonce dans la zone de construction. functions.enable_US(ser,'0') functions.move_push(ser,x-0.3,team*(y-0.75)) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.disable_pumps(ser) functions.close_wings(ser) sleep(0.5) functions.set_speed(ser,0) functions.set_speed(ser,3) sleep(0.05) functions.move_push(ser,0.3,team*(0.2),0.15) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.enable_US(ser,'F') print "Et une colonne de plus ! Une !"
import functions k = int(input("Enter number of times to rotate")) lis = list(map(int, input().split())) print(functions.rotate(k, lis))
def Script_Recalage (ser,team): functions.enable_sicks(ser,'0') functions.set_speed(ser,0.4) functions.move_speed(ser,-0.2,0) sleep(0.5) functions.set_x(ser,0.25) functions.set_y(ser,team*(-0.94)) functions.set_t(ser,team*(90)) functions.move_pos(ser,0.25,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_speed(ser,-0.2,0) sleep(0.5) functions.set_x(ser,0) functions.set_y(ser,0) functions.move_pos(ser,0,0)
def Prise_Grand_Tas_De_Sable(ser,team,configuration): ### Rotation vers les blocs de sable functions.move_push(ser,0.83,team*0.5,0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.open_bras(ser) ### Avancee vers les blocs de sable functions.rotate(ser,team*90) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_pos(ser,0.83,team*0.68) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,team*90) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### CALAGE SUR LES BLOCS functions.move_speed(ser,0.1,0) sleep(0.5) functions.set_y(ser,team*0.7) sleep(0.01) functions.move_pos(ser,0.83,team*0.7) ### PRISE DES BLOCS functions.catch(ser) sleep(1.2) functions.set_acc(ser,0.4,12,0.9) functions.set_speed(ser,0.2) functions.set_speed_ang(ser,1) ### Recul functions.move_push(ser,0.83,team*0.50,0.1) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### CHEMIN VERS LES ZONE DE CONSTRUCTION functions.move_push(ser,0.35,team*(0.1),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.rotate(ser,team*(-45)) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,0.60,team*(-0.16),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.move_push(ser,1.05,team*(-0.4),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) ### LACHER DU SABLE functions.rotate(ser,team*50) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.open_bras(ser) sleep(1) ### CONTRAINTES DE VITESSE PAR DEFAUT functions.set_speed(ser,0) functions.set_speed_ang(ser,4) if configuration<4: functions.move_push(ser,0.72,team*(-0.8),0.2) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.close_bras(ser) functions.move_push(ser,0.72,team*(-0.8),0) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) elif (configuration==4) or (configuration==5): functions.move_push(ser,0.7,team*(-0.65),0.16) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) functions.close_bras(ser) functions.move_push(ser,0.1,team*(-0.6),0.15) answer = functions.get_ans(ser) while answer != "$DONE;": answer = functions.get_ans(ser) print "Et un tas de sable en plus! Un ! +24 points potentiels."
def draw(self): functions.rotate(self.screen, self.bodyImg, functions.convert(self.body.position), (132 / 2, 192 / 2), math.degrees(self.body.angle)) self.barrel.draw()