下载客户端

世界前20仙人掌(21秒969毫秒)

2026-02-18 13:00:20
发布在编程农场
转载

导读

这是一份无人机仙人掌种植排序攻略,包含6个不同的无人机程序,涵盖摇瓶排序、仙人掌换盆、混合排序等类型,分单无人机和多无人机版本,各程序有对应的耗时和世界排名,其中单无人机带叶片摇瓶排序耗时21秒969毫秒,位列世界第20。

本指南包含5个程序:1)多无人机摇瓶排序(41秒626毫秒,排名118)2)多无人机仙人掌移栽(约46秒514毫秒,排名130)3)单无人机摇瓶排序(22秒814毫秒,排名20)4)单无人机带列表摇瓶排序(21秒969毫秒,排名20)5)单无人机仙人掌移栽,适合编写懒人代码(1分10秒,排名131)6)混合本教程包含5个程序: 1. 摇瓶排序,多无人机(41秒626毫秒,第118名) 2. 简单仙人掌换盆,多无人机(46秒514毫秒,约第130名) 3. 摇瓶排序,单无人机(22秒814毫秒,第20名) 4. 带叶片的摇瓶排序,单无人机(21秒969毫秒,第20名) 5. 简单仙人掌换盆,单无人机,如果你真想要懒人代码(1分10秒,第131名) 6. 多无人机混合排序(29秒631毫秒,第50名)视频攻略

1) Shaker Sort, many drones (41 seconds 626 milliseconds, 118 place) 1) Шейкерная сортировка много дронов (41 секунда 626 миллисекунд 118 место) Возможно улучшу её взяв из 4 программы лист. I might improve it by taking list from program 4. clear() #go_to new position def move_to(new_pos_x, new_pos_y): new_pos_x -= get_pos_x() new_pos_y -= get_pos_y() if new_pos_x > 16: new_pos_x = new_pos_x - 32 elif new_pos_x < -16: new_pos_x = new_pos_x + 32 if new_pos_y > 16: new_pos_y = new_pos_y - 32 elif new_pos_y < -16: new_pos_y = new_pos_y + 32 if new_pos_y > 0: for i in range(new_pos_y): move(North) elif new_pos_y < 0: for i in range(abs(new_pos_y)): move(South) if new_pos_x > 0: for i in range(new_pos_x): move(East) elif new_pos_x < 0: for i in range(abs(new_pos_x)): move(West) def water(): if get_water() < 0.5: use_item(Items.Water) use_item(Items.Fertilizer) def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: #harvest() plant(Entities.Cactus) def can_swap(direction): current = measure() neighbor = measure(direction) # Нельзя свапать, если кто-то не готов if current == None or neighbor == None: return False elif direction == North and get_pos_y() != get_world_size()-1 or direction == East and get_pos_x() != get_world_size()-1: # Текущий должен быть <= соседа return current > neighbor # если НАРУШЕНО — меняем elif direction == South and get_pos_y() != 0 or direction == West and get_pos_x() != 0: # Текущий должен быть >= соседа return current < neighbor # если НАРУШЕНО — меняем else: return False def pro_swap(direction): if can_swap(direction): swap(direction) return True else: return False def pro_cactus_gorizontal(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_x() + 1: if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 move(East) if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 if not swapped: break if k > 3: ind_max -= (k-2) / 2 ind_max -= 1 if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_x() - 1: if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 move(West) if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 if k > 3: ind_min += (k-2) / 2 ind_min += 1 if not swapped: break if ind_max <= ind_min: break def pro_cactus_vertical(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 for i in range(WorldSize): PlantCactus() pro_swap(South) move(North) while True: swapped = False k = 0 while ind_max > get_pos_y() + 1: if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 move(North) if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if k > 4: ind_max -= (k-3) / 3 ind_max -= 1 if not swapped: break if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_y() - 1: if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 move(South) if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if k > 4: ind_min += (k-3) / 3 ind_min += 1 if not swapped: break if ind_max <= ind_min: break while num_items(Items.Cactus) < 33554432: for i in range(max_drones()-1): spawn_drone(pro_cactus_vertical) move(East) pro_cactus_vertical() move_to(0, get_pos_y()) while num_drones() > 1: pass for i in range(max_drones()-1): spawn_drone(pro_cactus_gorizontal) move(North) pro_cactus_gorizontal() while num_drones() > 1: pass harvest() move_to(get_pos_x(), 0) 2) Simple Cacti Repotting, many drones (46 seconds 514 milliseconds, approximately 130 place) 2) Просто пересадка кактусов много дронов (46 секунд 514 миллисекунд 130 место примерно) clear() def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: plant(Entities.Cactus) def intelegense_measure(): mes = measure() mesS = measure(South) mesW = measure(West) if mes != None and mesS != None and mesW != None and get_pos_x() != 0 and mes >= mesW and get_pos_y() != 0 and mes >= mesS: return False elif mes != None and mesS != None and get_pos_x() == 0 and get_pos_y() != 0 and mes >= mesS: return False elif mes != None and mesW != None and get_pos_x() != 0 and get_pos_y() == 0 and mes >= mesW: return False elif get_pos_y() == 0 and get_pos_x() == 0: return False else: return True def strange_cactus(): for i in range(get_world_size()): PlantCactus() while measure() !=4: till() PlantCactus() move(North) while not can_harvest(): pass while num_items(Items.Cactus) < 33554432: for i in range(max_drones()-1): spawn_drone(strange_cactus) move(East) strange_cactus() while num_drones() > 1: pass do_a_flip() harvest() 3) Shaker Sort, one drone (22 seconds 814 milliseconds, 20 place) 3) Шейкерная сортировка один дрон (22 секунды 814 миллисекунд 20 место) clear() def go_and_swap_to_start_vertical(i): y = get_pos_y()-1 if i != 0: move(East) if y > 0: for j in range(y): pro_swap(North) pro_swap(South) move(South) def go_and_swap_to_start_gorizontal(i): x = get_pos_x()-1 if i != 0: move(North) if x > 0: for j in range(x): pro_swap(East) pro_swap(West) move(West) def move_like_snake(x0, y0, xmax, ymax): xnew = get_pos_x() - x0 ynew = get_pos_y() - y0 if xnew == 0 and ynew > 0: move(South) elif ynew % 2 == 0: if xnew == xmax-1: move(North) else: move(East) elif xnew == 1 and ynew != ymax-1: move(North) else: move(West) def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: plant(Entities.Cactus) def can_swap(direction): current = measure() neighbor = measure(direction) # Нельзя свапать, если кто-то не готов if current == None or neighbor == None: return False elif direction == North and get_pos_y() != get_world_size()-1 or direction == East and get_pos_x() != get_world_size()-1: # Текущий должен быть <= соседа return current > neighbor # если НАРУШЕНО — меняем elif direction == South and get_pos_y() != 0 or direction == West and get_pos_x() != 0: # Текущий должен быть >= соседа return current < neighbor # если НАРУШЕНО — меняем else: return False def pro_swap(direction): if can_swap(direction): swap(direction) return True else: return False def pro_cactus_gorizontal(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_x() + 1: if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 move(East) if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 if not swapped: break if k > 3: ind_max -= (k-2) / 2 ind_max -= 1 if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_x() - 1: if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 move(West) if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 if k > 3: ind_min += (k-2) / 2 ind_min += 1 if not swapped: break if ind_max <= ind_min: break def pro_cactus_vertical(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_y() + 1: if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 move(North) if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if k > 4: ind_max -= (k-3) / 3 ind_max -= 1 if not swapped: break if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_y() - 1: if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 move(South) if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if k > 4: ind_min += (k-3) / 3 ind_min += 1 if not swapped: break if ind_max <= ind_min: break #set_world_size(8) WorldSize = get_world_size() while num_items(Items.Cactus) < 131072: for i in range(WorldSize*WorldSize): PlantCactus() pro_swap(North) pro_swap(West) pro_swap(South) pro_swap(East) move_like_snake(0, 0, WorldSize, WorldSize) for i in range(WorldSize): go_and_swap_to_start_vertical(i) pro_cactus_vertical() for j in range(WorldSize): go_and_swap_to_start_gorizontal(j) pro_cactus_gorizontal() harvest() 4) Shaker Sort with Leaf, one drone (21 seconds 969 milliseconds, 20th place) 4) Шейкерная сортировка с листом один дрон (21 секунда 969 миллисекунд 20 место) clear() def mega_pro_swap(dir1, dir2): if pro_swap(dir1): if pro_swap(dir2): #if pro_swap(dir1): #return True return True return True elif pro_swap(dir2): if pro_swap(dir1): #if pro_swap(dir2): #return True return True return True else: return False def go_and_swap_to_start_vertical(i): y = get_pos_y()-1 if i != 0: move(East) if y > 0: for j in range(y): mega_pro_swap(North, South) move(South) def go_and_swap_to_start_gorizontal(i): x = get_pos_x()-1 if i != 0: move(North) if x > 0: for j in range(x): mega_pro_swap(East, West) move(West) def move_like_snake(x0, y0, xmax, ymax): xnew = get_pos_x() - x0 ynew = get_pos_y() - y0 if xnew == 0 and ynew > 0: move(South) elif ynew % 2 == 0: if xnew == xmax-1: move(North) else: move(East) elif xnew == 1 and ynew != ymax-1: move(North) else: move(West) def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: plant(Entities.Cactus) def can_swap(direction): current = measure() neighbor = measure(direction) # Нельзя свапать, если кто-то не готов if current == None or neighbor == None: return False elif direction == North and get_pos_y() != get_world_size()-1 or direction == East and get_pos_x() != get_world_size()-1: # Текущий должен быть <= соседа return current > neighbor # если НАРУШЕНО — меняем elif direction == South and get_pos_y() != 0 or direction == West and get_pos_x() != 0: # Текущий должен быть >= соседа return current < neighbor # если НАРУШЕНО — меняем else: return False def pro_swap(direction): if can_swap(direction): swap(direction) return True else: return False def pro_cactus_gorizontal(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_x() + 1: if mega_pro_swap(East, West): swapped = True k = 0 else: k += 1 move(East) if mega_pro_swap(East, West): swapped = True k = 0 else: k += 1 if not swapped: break if k > 1: ind_max -= k else: ind_max -= 1 if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_x() - 1: if mega_pro_swap(West, East): swapped = True k = 0 else: k += 1 move(West) if mega_pro_swap(West, East): swapped = True k = 0 else: k += 1 if not swapped: break if k > 1: ind_min += k else: ind_min += 1 if ind_max <= ind_min: break def pro_cactus_vertical(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_y() + 1: if mega_pro_swap(North, South): swapped = True k = 0 else: k += 1 move(North) if mega_pro_swap(North, South): swapped = True k = 0 else: k += 1 if not swapped: break if k > 1: ind_max -= k else: ind_max -= 1 if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_y() - 1: if mega_pro_swap(South, North): swapped = True k = 0 else: k += 1 move(South) if mega_pro_swap(South, North): swapped = True k = 0 else: k += 1 if not swapped: break if k > 1: ind_min += k else: ind_min += 1 if ind_max <= ind_min: break #set_world_size(8) WorldSize = get_world_size() while num_items(Items.Cactus) < 131072: for i in range(WorldSize*WorldSize): PlantCactus() pro_swap(North) pro_swap(West) pro_swap(South) pro_swap(East) move_like_snake(0, 0, WorldSize, WorldSize) for i in range(WorldSize): go_and_swap_to_start_vertical(i) pro_cactus_vertical() for j in range(WorldSize): go_and_swap_to_start_gorizontal(j) pro_cactus_gorizontal() harvest() 5) Simple Cacti Repotting, one drone, if you really want lazy code (1 minute 10 seconds, 131 place) 5) Просто пересадка кактусов один дрон, ну если очень хочется ленивый код (1 минута 10 секунд 131 место) clear() def move_like_snake(x0, y0, xmax, ymax): xnew = get_pos_x() - x0 ynew = get_pos_y() - y0 if xnew == 0 and ynew > 0: move(South) elif ynew % 2 == 0: if xnew == xmax-1: move(North) else: move(East) elif xnew == 1 and ynew != ymax-1: move(North) else: move(West) def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: plant(Entities.Cactus) WorldSize = get_world_size() while num_items(Items.Cactus) < 131072: for i in range(WorldSize*WorldSize): PlantCactus() while measure() !=4: till() PlantCactus() move_like_snake(0, 0, WorldSize, WorldSize) while not can_harvest(): pass harvest() 6) Hybrid sorting of many drones (29 seconds 631 milliseconds, 50th place) 6) Гибридная сортировка много дронов (29 секунд 631 миллисекунда 50 место) clear() #go_to new position def move_to(new_pos_x, new_pos_y): new_pos_x -= get_pos_x() new_pos_y -= get_pos_y() if new_pos_x > 16: new_pos_x = new_pos_x - 32 elif new_pos_x < -16: new_pos_x = new_pos_x + 32 if new_pos_y > 16: new_pos_y = new_pos_y - 32 elif new_pos_y < -16: new_pos_y = new_pos_y + 32 if new_pos_y > 0: for i in range(new_pos_y): move(North) elif new_pos_y < 0: for i in range(abs(new_pos_y)): move(South) if new_pos_x > 0: for i in range(new_pos_x): move(East) elif new_pos_x < 0: for i in range(abs(new_pos_x)): move(West) def water(): if get_water() < 0.5: use_item(Items.Water) use_item(Items.Fertilizer) def PlantCactus(): if get_ground_type() != Grounds.Soil: till() while get_entity_type() != Entities.Cactus: #harvest() plant(Entities.Cactus) if get_pos_x() + get_pos_y() > get_world_size() * 1.3 and measure() >= 6: pass elif get_pos_x() + get_pos_y() <= get_world_size() * 1.3 and get_pos_x() + get_pos_y() >= get_world_size() * 0.7 and measure() >= 3 and measure() <= 6: pass elif get_pos_x() + get_pos_y() < get_world_size() * 0.7 and measure() <= 3: pass else: till() till() def can_swap(direction): current = measure() neighbor = measure(direction) # Нельзя свапать, если кто-то не готов if current == None or neighbor == None: return False elif direction == North and get_pos_y() != get_world_size()-1 or direction == East and get_pos_x() != get_world_size()-1: # Текущий должен быть <= соседа return current > neighbor # если НАРУШЕНО — меняем elif direction == South and get_pos_y() != 0 or direction == West and get_pos_x() != 0: # Текущий должен быть >= соседа return current < neighbor # если НАРУШЕНО — меняем else: return False def pro_swap(direction): if can_swap(direction): swap(direction) return True else: return False def pro_cactus_gorizontal(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 while True: swapped = False k = 0 while ind_max > get_pos_x() + 1: if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 move(East) if pro_swap(East): swapped = True k = 0 else: k += 1 if pro_swap(West): swapped = True k = 0 else: k += 1 if not swapped: break if k > 3: ind_max -= (k-2) / 2 ind_max -= 1 if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_x() - 1: if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 move(West) if pro_swap(West): swapped = True k = 0 else: k += 1 if pro_swap(East): swapped = True k = 0 else: k += 1 if k > 3: ind_min += (k-2) / 2 ind_min += 1 if not swapped: break if ind_max <= ind_min: break def pro_cactus_vertical(): WorldSize = get_world_size() ind_max = WorldSize - 1 ind_min = 0 for i in range(WorldSize): PlantCactus() pro_swap(South) move(North) while True: swapped = False k = 0 while ind_max > get_pos_y() + 1: if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 move(North) if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if k > 4: ind_max -= (k-3) / 3 ind_max -= 1 if not swapped: break if ind_max <= ind_min: break swapped = False k = 0 while ind_min < get_pos_y() - 1: if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 move(South) if pro_swap(North): swapped = True k = 0 else: k += 1 if pro_swap(South): swapped = True k = 0 else: k += 1 if pro_swap(North): swapped = True k = 0 else: k += 1 if k > 4: ind_min += (k-3) / 3 ind_min += 1 if not swapped: break if ind_max <= ind_min: break while num_items(Items.Cactus) < 33554432: for i in range(max_drones()-1): spawn_drone(pro_cactus_vertical) move(East) pro_cactus_vertical() move_to(0, get_pos_y()) while num_drones() > 1: pass for i in range(max_drones()-1): spawn_drone(pro_cactus_gorizontal) move(North) pro_cactus_gorizontal() while num_drones() > 1: pass harvest() move_to(get_pos_x(), 0)

评论

共0条评论
face
inputImg
最新更新

打字器已替换,点点寻宝发布与改进

大家好👋 今天我有个有趣的东西要分享。 几个月前,我们有了个有趣的想法:要是能用《农场主被替换了》来自动操作另一个游戏会怎么样?这是我们为此做的一个小实验: …

2026-04-13 11:270赞 · 0评论

Recycling Achievement

轻松获取重复使用同一迷宫300次成就的提示与方法 获取【Recycling】成就的方法: 要获得【Recycling】成就,你需要重复使用同一个迷宫300次。 …

2026-04-07 07:000赞 · 0评论

使用嵌套函数解决迷宫问题

一个用于解决迷宫的极简嵌套函数方案。 其工作原理: 一个用于解决迷宫的极简嵌套函数方案。 定义执行分支(起点): 若获取实体类型()等于实体.宝藏: 收获() …

2026-02-20 16:000赞 · 0评论

俄语翻译

很遗憾,这款游戏没有被翻译成所有语言,因为像这种实用的、教授编程的游戏应该面向所有人,包括那些英语掌握不够熟练的人。有一种观点认为,如果从事编程工作,就应该懂英…

2026-02-20 16:000赞 · 0评论

解锁成本

自动化 farming 的终极挑战是尽可能快速地自动完成游戏流程。以下是游戏自动化相关的解锁内容概述: 解锁树 本指南包含游戏 1.0 版本前的解锁成本信息。

2026-02-20 16:000赞 · 0评论

《仙人掌农场》(2025)

It's the cactus farm, with explanations inside the code as comments. You can jus…

2026-02-20 10:000赞 · 0评论

编程初学者的代码

*DUE TO STILL GOING THROUGH THE GAME, THIS IS A WIP. * I have never created, lea…

2026-02-20 07:000赞 · 0评论

成就解锁器.exe

# 奖杯自动化 解锁(成就) 循环导入和栈溢出 此成就需要2个脚本:f0和f1 循环导入f0: import f1 f1: import f0

2026-02-20 07:000赞 · 0评论

解开迷宫

The maze levels are very different than the remainder of the game. It's possible…

2026-02-20 01:000赞 · 0评论

大多数成就代码

Title is self explaining I want to say something First of all im not a native sp…

2026-02-19 22:000赞 · 0评论
暂无更多