
Title is self explaining I want to say something First of all im not a native speaker so im sorry if there are any spelling or grammar mistakes. Second of all NOT all of the codes below are self written. A lot of them are copied from other websites and sometimes modified to fit the conditions. I do not know anymore where they came from but i wanted to share working code for every or nearly every Achievement in the game. Important: These codes are most likely not working in the early stages of the game. So far i can tell that you need to unlock at least 32 Drones; Polyculture; 32x32 Farmsize; Basic math stuff; funktions; Import maybe im missing something Hello World; Infinityloop; Error; Acrobat; Stylish For every one that managed to skip the inevitable Achievemnts: while True: pet_the_piggy() do_a_flip() change_hat(Hats.Brown_Hat) Make_Error() Hay clear() world_size = get_world_size() change_hat(Hats.Brown_Hat) companion_mapping = {} hay_mapping = {} def track_companion(curr_x, curr_y): global companion_mapping global hay_mapping result = get_companion() if result == None: return False target_entity, (target_x, target_y) = result if (target_x, target_y) not in companion_mapping: companion_mapping[(target_x, target_y)] = target_entity hay_mapping[(curr_x, curr_y)] = (target_x, target_y) return True return False def drone_hay_task(): global world_size global companion_mapping global hay_mapping while True: for j in range(world_size): curr_x = get_pos_x() curr_y = get_pos_y() harvest() if get_ground_type() == Grounds.Soil: till() if (curr_x, curr_y) in companion_mapping: target_entity = companion_mapping[(curr_x, curr_y)] if target_entity == Entities.Carrot: if get_ground_type() != Grounds.Soil: till() plant(Entities.Carrot) elif target_entity != Entities.Grass: plant(target_entity) else: if (curr_x, curr_y) in hay_mapping: companion_pos = hay_mapping.pop((curr_x, curr_y)) if companion_pos in companion_mapping: companion_mapping.pop(companion_pos) track_companion(curr_x, curr_y) move(North) NUM_DRONES_TO_SPAWN = world_size - 1 for i in range(NUM_DRONES_TO_SPAWN): while num_drones() >= max_drones(): pass spawn_drone(drone_hay_task) move(East) drone_hay_task() Carrots clear() world_size = get_world_size() change_hat(Hats.Brown_Hat) companion_mapping = {} carrot_mapping = {} def track_companion(curr_x, curr_y): global companion_mapping global carrot_mapping result = get_companion() if result == None: return False target_entity, (target_x, target_y) = result if (target_x, target_y) not in companion_mapping: companion_mapping[(target_x, target_y)] = target_entity carrot_mapping[(curr_x, curr_y)] = (target_x, target_y) return True return False def prepare_and_plant(entity_type): if entity_type in (Entities.Carrot, Entities.Bush, Entities.Tree) and get_ground_type() != Grounds.Soil: till() plant(entity_type) def drone_carrot_task(): global world_size global companion_mapping global carrot_mapping while True: for j in range(world_size): curr_x = get_pos_x() curr_y = get_pos_y() harvest() if (curr_x, curr_y) in companion_mapping: target_entity = companion_mapping[(curr_x, curr_y)] prepare_and_plant(target_entity) if target_entity == Entities.Carrot and get_water() < 0.10: use_item(Items.Water) elif (curr_x, curr_y) in carrot_mapping: prepare_and_plant(Entities.Carrot) if get_water() < 0.10: use_item(Items.Water) companion_pos = carrot_mapping.pop((curr_x, curr_y)) if companion_pos in companion_mapping: companion_mapping.pop(companion_pos) track_companion(curr_x, curr_y) else: prepare_and_plant(Entities.Carrot) if get_water() < 0.10: use_item(Items.Water) track_companion(curr_x, curr_y) move(North) NUM_DRONES_TO_SPAWN = world_size - 1 for i in range(NUM_DRONES_TO_SPAWN): while num_drones() >= max_drones(): pass spawn_drone(drone_carrot_task) move(East) drone_carrot_task() Wood clear() world_size = get_world_size() change_hat(Hats.Brown_Hat) companion_mapping = {} tree_mapping = {} def tree_tile(curr_x, curr_y): return curr_x % 2 == curr_y % 2 def track_companion(curr_x, curr_y): global companion_mapping global tree_mapping result = get_companion() if result == None: return False target_entity, (target_x, target_y) = result if (target_x, target_y) not in companion_mapping: companion_mapping[(target_x, target_y)] = target_entity tree_mapping[(curr_x, curr_y)] = (target_x, target_y) return True return False def drone_tree_task(): global world_size global companion_mapping global tree_mapping while True: for j in range(world_size): curr_x = get_pos_x() curr_y = get_pos_y() if tree_tile(curr_x, curr_y): if can_harvest(): harvest() plant(Entities.Tree) if (curr_x, curr_y) in tree_mapping: companion_pos = tree_mapping.pop((curr_x, curr_y)) if companion_pos in companion_mapping: companion_mapping.pop(companion_pos) track_companion(curr_x, curr_y) if get_water() < 0.40: use_item(Items.Water) elif (curr_x, curr_y) in companion_mapping: target_entity = companion_mapping[(curr_x, curr_y)] harvest() if target_entity == Entities.Grass: if get_ground_type() != Grounds.Grassland: till() elif target_entity == Entities.Carrot: if get_ground_type() != Grounds.Soil: till() plant(target_entity) else: harvest() plant(Entities.Bush) move(North) NUM_DRONES_TO_SPAWN = 31 for i in range(NUM_DRONES_TO_SPAWN): while num_drones() >= max_drones(): pass spawn_drone(drone_tree_task) move(East) drone_tree_task() Sunflower clear() change_hat(Hats.Purple_Hat) def Sunflower(): def harvestColum(): for _ in range(get_world_size()): if get_ground_type()!=Grounds.Soil: till() plant(Entities.Sunflower) if can_harvest(): harvest() plant(Entities.Sunflower) move(North) else: move(North) while num_items(Items.Power)<40000000: if spawn_drone(harvestColum): move(East) Sunflower() Pumpkin clear() change_hat(Hats.Brown_Hat) set_world_size(32) world_size = get_world_size() first_pass = True def check_pumpkin(): if get_pos_x() != 0: move(East) left_id = measure() move(West) right_id = measure() move(East) return left_id == right_id def wait_for_drones(drones): for drone in drones: wait_for(drone) def plant_column(): global world_size for j in range(world_size): if get_entity_type() != Entities.Pumpkin: if get_ground_type() != Grounds.Soil: till() plant(Entities.Pumpkin) if not first_pass: while not can_harvest(): if get_entity_type() == Entities.Dead_Pumpkin: plant(Entities.Pumpkin) use_item(Items.Fertilizer) move(North) def plant_pumpkins(): global world_size #global first_pass drones = [] if get_pos_x() != 0: move(East) for i in range(world_size - 1): drones.append(spawn_drone(plant_column)) move(East) plant_column() wait_for_drones(drones) while True: plant_pumpkins() first_pass = False if check_pumpkin(): harvest() first_pass = True move(West) Cactus while True: WORLD_SIZE = get_world_size() MAX_DRONES = max_drones() def main(): plant_and_sort_all_rows() sort_all_columns() def plant_and_sort_all_rows(): global WORLD_SIZE for row in range(WORLD_SIZE): if num_drones() >= WORLD_SIZE: move_to(0, row) pas_current_row() break move_to(0, row) drone = spawn_drone(pas_current_row) move_to(0,1) while num_drones() > 1: pass def pas_current_row(): global WORLD_SIZE row = get_pos_y() for col in range(WORLD_SIZE): move_to(col, row) till() plant(Entities.Cactus) insertion_sort_row_step() def insertion_sort_row_step(): while get_pos_x() > 0: if measure() < measure(West): swap(West) move(West) else: break def sort_all_columns(): global WORLD_SIZE global MAX_DRONES for col in range(WORLD_SIZE): move_to(col, 1) while num_drones() >= MAX_DRONES: sort_current_column() break spawn_drone(sort_current_column) while num_drones() > 1: pass def sort_current_column(): global WORLD_SIZE while get_pos_y() < (WORLD_SIZE - 1): insertion_sort_column_step() insertion_sort_column_step() def insertion_sort_column_step(): if get_pos_y() == 0: move(North) return if measure() < measure(South): swap(South) if get_pos_y() > 1: move(South) insertion_sort_column_step() return move(North) def move_to(x, y): global WORLD_SIZE dx = x - get_pos_x() dy = y - get_pos_y() if dx > 0: if dx > WORLD_SIZE/2: move(West) else: move(East) elif dx < 0: if abs(dx) > WORLD_SIZE/2: move(East) else: move(West) if dy > 0: if dy > WORLD_SIZE/2: move(South) else: move(North) elif dy < 0: if abs(dy) > WORLD_SIZE/2: move(North) else: move(South) if not (get_pos_x() == x and get_pos_y() == y): move_to(x, y) else: return if __name__ == "__main__": clear() main() harvest() Maze (Recycling&Labyrinthmaster not working) ALL_DIRECTIONS = [North, South, East, West] #change map size here ( remove "#" below) #set_world_size(15) clear() def opposite_direction(direction): if direction == North: return South elif direction == East: return West elif direction == South: return North elif direction == West: return East def explore_option_iterative(start_direction): global ALL_DIRECTIONS if not move(start_direction): return False path_stack = [(start_direction, 0)] while path_stack and num_items(Items.Gold) < 9863168000000: if get_entity_type() == Entities.Treasure: harvest() start_maze() return True last_move_direction, next_dir_index = path_stack[-1] while next_dir_index < len(ALL_DIRECTIONS): explore_direction = ALL_DIRECTIONS[next_dir_index] path_stack[-1] = (last_move_direction, next_dir_index + 1) if opposite_direction(explore_direction) != last_move_direction: if move(explore_direction): path_stack.append((explore_direction, 0)) break next_dir_index += 1 if next_dir_index == len(ALL_DIRECTIONS): path_stack.pop() move(opposite_direction(last_move_direction)) move(opposite_direction(start_direction)) return False def start_maze(): plant(Entities.Bush) substance = get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1) use_item(Items.Weird_Substance, substance) def search(): global drone_id global ALL_DIRECTIONS for _ in range(drone_id): do_a_flip() if drone_id % 2: ALL_DIRECTIONS = ALL_DIRECTIONS[::-1] if drone_id % 3: ALL_DIRECTIONS[0], ALL_DIRECTIONS[1] = (ALL_DIRECTIONS[1], ALL_DIRECTIONS[0]) if drone_id % 5: ALL_DIRECTIONS[1], ALL_DIRECTIONS[3] = (ALL_DIRECTIONS[3], ALL_DIRECTIONS[1]) while True: for direction in ALL_DIRECTIONS: if explore_option_iterative(direction): break drone_id = 0 start_maze() for i in range(max_drones()): drone_id = i spawn_drone(search) drone_id = 0 search() # For the "Recycling" and "Big Gold Farmer" achievements def generate_maze(): plant(Entities.Bush) substance = get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1) use_item(Items.Weird_Substance, substance) def maze(): while True: if num_drones() == 25: if get_entity_type() == Entities.Treasure: harvest() generate_maze() clear() set_world_size(5) list = [] while num_drones() < 26: pos_x = get_pos_x() pos_y = get_pos_y() current = (pos_x, pos_y) if current not in list: list.append(current) spawn_drone(maze) move(North) else: move(East) Dino #change worldsize below by removing "#" #set_world_size(12) world_size = get_world_size() world_size_minus_one = world_size - 1 edge_positions = [0, world_size_minus_one] offlimit_columns_stage1 = { } offlimit_columns_stage2 = { } clear() change_hat(Hats.Dinosaur_Hat) apple_pos = measure() squares_occupied = 1 game_complete = False aggressive_stage = True def measure_apple(): global apple_pos global squares_occupied global apple_pos_queue apple_pos = measure() squares_occupied += 1 def move_and_check_apple(direction): global apple_pos if not move(direction): return False if (get_pos_x(), get_pos_y()) == apple_pos: measure_apple() return True def move_to_col(target_x_pos, do_measure=True): global world_size global apple_pos curr_x = get_pos_x() direction = West if curr_x < target_x_pos: direction = East for x in range(abs(target_x_pos - curr_x)): this_check = move if do_measure: this_check = move_and_check_apple if not this_check(direction): return False return True def move_to_row(target_y_pos, do_measure=True): global world_size global apple_pos curr_y = get_pos_y() direction = South if curr_y < target_y_pos: direction = North for y in range(abs(target_y_pos - curr_y)): this_check = move if do_measure: this_check = move_and_check_apple if not this_check(direction): return False return True def transition_to_stage_2(): global offlimit_columns_stage1 global world_size global world_size_minus_one move_to_col(world_size_minus_one) move_to_row(0) offlimit_columns_stage1 = { } return False def transition_to_stage_1(): global offlimit_columns_stage2 global world_size global world_size_minus_one move_to_col(0) move_to_row(world_size_minus_one) offlimit_columns_stage2 = { } return False def stage_1_apple_collect(): global apple_pos global world_size global offlimit_columns_stage1 global offlimit_columns_stage2 global world_size_minus_one apple_pos_x, apple_pos_y = apple_pos if apple_pos_y == 0 or apple_pos_x in edge_positions or (apple_pos_x in offlimit_columns_stage1 and apple_pos_y <= offlimit_columns_stage1[apple_pos_x]): return transition_to_stage_2() else: apple_x_odd = apple_pos_x % 2 target_x_pos = apple_pos_x if not apple_x_odd: target_x_pos = apple_pos_x - 1 if target_x_pos <= get_pos_x(): return transition_to_stage_2() else: move_to_col(target_x_pos) move_to_row(apple_pos_y) offlimit_columns_stage2[target_x_pos] = apple_pos_y offlimit_columns_stage2[target_x_pos + 1] = apple_pos_y move_and_check_apple(East) move_to_row(world_size_minus_one) return True def stage_2_apple_collect(): global apple_pos global world_size global offlimit_columns_stage1 global offlimit_columns_stage2 global world_size_minus_one apple_pos_x, apple_pos_y = apple_pos if apple_pos_y == world_size_minus_one or apple_pos_x in edge_positions or (apple_pos_x in offlimit_columns_stage2 and apple_pos_y >= offlimit_columns_stage2[apple_pos_x]): return transition_to_stage_1() else: apple_x_odd = apple_pos_x % 2 target_x_pos = apple_pos_x if apple_x_odd: target_x_pos = apple_pos_x + 1 if target_x_pos >= get_pos_x(): return transition_to_stage_1() else: move_to_col(target_x_pos) move_to_row(apple_pos_y) offlimit_columns_stage1[target_x_pos] = apple_pos_y offlimit_columns_stage1[target_x_pos - 1] = apple_pos_y move_and_check_apple(West) move_to_row(0) return True def move_to_right_col_wavy(): global world_size global world_size_minus_one global offlimit_columns_stage1 # Assume curr x is zero for x in range(world_size): if x % 2: target_y = 1 if x in offlimit_columns_stage1: target_y = offlimit_columns_stage1[x] + 1 while get_pos_y() != target_y: move(South) move(East) else: # x is even, go up to top row, then move right while get_pos_y() != world_size_minus_one: move(North) move(East) def find_top_left(): global world_size_minus_one while get_pos_x() > 0: move(West) while get_pos_y() < world_size_minus_one: move(North) def transition_to_route(): find_top_left() move_to_right_col_wavy() while get_pos_y() != 0: move(South) while get_pos_x() != 0: move(West) # STAGE 1 move_to_row(world_size_minus_one) while aggressive_stage: while stage_1_apple_collect() and get_pos_x() < world_size_minus_one: pass while stage_2_apple_collect() and get_pos_x() > 0: pass if squares_occupied > (world_size_minus_one) * 4 - 4: break transition_to_route() while True: for i in range(world_size / 2): game_complete = not move_to_row(world_size_minus_one, False) game_complete = game_complete or not move(East) game_complete = game_complete or not move_to_row(1, False) if i != world_size / 2 - 1: game_complete = game_complete or not move(East) if game_complete: break game_complete = game_complete or not move_to_row(0, False) game_complete = game_complete or not move_to_col(0,) if game_complete: break change_hat(Hats.Straw_Hat) Import Zyklus You need 2 different code-windows First window: def f0(): import ImportzyklusZubehör ImportzyklusZubehör.f1() f0() Second Window: def f1(): import ImportZyklus ImportZyklus.f0() You get the Achievement by running the first code-window Wrong Order clear() hats = [Hats.Green_Hat, Hats.Purple_Hat] #set_world_size(6) world_size = get_world_size() def _shortest_delta(curr, dest): size = world_size d = (dest - curr) % size if d > size / 2: d -= size return d def move_to_x_pos(x_target): x_curr = get_pos_x() moves_needed = _shortest_delta(x_curr, x_target) direction = East if moves_needed > 0: pass else: direction = West for _ in range(abs(moves_needed)): move(direction) def move_to_y_pos(y_target): y_curr = get_pos_y() moves_needed = _shortest_delta(y_curr, y_target) direction = North if moves_needed > 0: pass else: direction = South for _ in range(abs(moves_needed)): move(direction) def wait_for_drones(drones): for drone in drones: wait_for(drone) def drone_action_plant_cacti(): global world_size change_hat(hats[get_pos_x() % 2]) for _ in range(world_size): if get_ground_type() != Grounds.Soil: till() plant(Entities.Cactus) move(North) def plant_cacti(): global world_size move_to_x_pos(0) move_to_y_pos(0) drones = [] for _ in range(world_size - 1): drones.append(spawn_drone(drone_action_plant_cacti)) move(East) drone_action_plant_cacti() move(East) move(North) wait_for_drones(drones) def shake_row(): global world_size change_hat(hats[get_pos_y() % 2]) left = 0 right = world_size - 1 while left < right: move_to_x_pos(left) loc_last_swap = left x_curr = get_pos_x() # Left-to-right pass while x_curr < right: # If the current element is smaller than the next, swap if measure() < measure(East): swap(East) loc_last_swap = x_curr move(East) x_curr += 1 right = loc_last_swap if left >= right: break move_to_x_pos(right) loc_last_swap = right x_curr = get_pos_x() # Right-to-left pass while x_curr > left: # If the previous element is larger than the current, swap if measure(West) > measure(): swap(West) loc_last_swap = x_curr move(West) x_curr -= 1 left = loc_last_swap def shake_col(): global world_size change_hat(hats[get_pos_x() % 2]) left = 0 right = world_size - 1 while left < right: move_to_y_pos(left) loc_last_swap = left y_curr = get_pos_y() # Bottom-to-top pass while y_curr < right: # If the current element is smaller than the one above, swap if measure() < measure(North): swap(North) loc_last_swap = y_curr move(North) y_curr += 1 right = loc_last_swap if left >= right: break move_to_y_pos(right) loc_last_swap = right y_curr = get_pos_y() # Top-to-bottom pass while y_curr > left: # If the element below is larger than the current, swap if measure(South) > measure(): swap(South) loc_last_swap = y_curr move(South) y_curr -= 1 left = loc_last_swap def sort_columns(): global world_size move_to_x_pos(0) move_to_y_pos(0) drones = [] for _ in range(world_size - 1): drones.append(spawn_drone(shake_col)) move(East) shake_col() move(East) move(North) wait_for_drones(drones) def sort_rows(): global world_size move_to_x_pos(0) move_to_y_pos(0) drones = [] for _ in range(world_size - 1): drones.append(spawn_drone(shake_row)) move(North) shake_row() move(North) wait_for_drones(drones) while True: plant_cacti() sort_columns() sort_rows() harvest() Fashionshow def newHat(): hats = [Hats.Gold_Hat, Hats.Golden_Cactus_Hat, Hats.Golden_Carrot_Hat, Hats.Golden_Sunflower_Hat, Hats.Golden_Tree_Hat] while True: move(North) change_hat(hats[get_pos_x() % 5]) while True: spawn_drone(newHat) move(East) Labyrinthmaster def generate_maze(): plant(Entities.Bush) substance = get_world_size() * 2**(num_unlocked(Unlocks.Mazes) - 1) use_item(Items.Weird_Substance, substance) def maze(): while True: if num_drones() == 25: if get_entity_type() == Entities.Treasure: harvest() generate_maze() clear() set_world_size(5) list = [] while num_drones() < 26: pos_x = get_pos_x() pos_y = get_pos_y() current = (pos_x, pos_y) if current not in list: list.append(current) spawn_drone(maze) move(North) else: move(East) Leaderboard Achievements ----Comming soon---- Trubelshooting Every bracket "()" closed? Every " : " placed? Every indentation correct? Right Version(code was written in version 1.0 and till 18.11.2025 working)? Hope it was usefull. If anything doesn´t work let me know :)
2026-02-19 22:00:15 发布在
编程农场
说点好听的...
收藏
0
0
