r/TheFarmerWasReplaced • • Jul 24 '26

🥳Thank you for joining r/TheFarmerWasReplaced🥳

16 Upvotes

🥳Thank you for joining r/TheFarmerWasReplaced🥳

Hi :D, I'm u/Any-Ad-4072, the main moderator of this sub reddit, if you have an issue, don't hesitate to contact me or the rest of the mod team through Mod mail.

Welcome to this community of geeks obsessed with a drone that replaced the farmer (and definitely didn't kill him🫪).

Here, you can share your thoughts about the game, show your code that you definitely didn't steal from someone else like any good code writter🤨. You can also report bugs and share update ideas. (Note: the game's main developer, Timon, is not part of the moderation team and doesn't see what is being said here, if you want to talk to Timon, you can go to the TheFarmerWasReplaced discord Unfortunately, the discord link goes to https://discord.gg/kj33cJkeJn


r/TheFarmerWasReplaced • • 6h ago

My farm first sunflower farm

3 Upvotes

def goto(x, y):

xx = get_pos_x() - x

xxx = xx - xx - xx

yy = get_pos_y() - y

yyy = yy - yy - yy

if get_pos_x() - x <0:

	for i in range(xxx):

		move(East)

else:

	for i in range(get_pos_x() - x):

		move(West)

if get_pos_y() - y <0:

set_world_size(8)

import goto

for n in range(get_world_size()):

	for n in range(get_world_size()):

till()

move(North)

	move(East)

while True:

goto.goto(0, 0)

fifteenx = \[\]

fifteeny = \[\]

fourteenx = \[\]

fourteeny = \[\]

thirteenx = \[\]

thirteeny = \[\]

twelvex = \[\]

twelvey = \[\]

elevenx = \[\]

eleveny = \[\]

tenx = \[\]

teny = \[\]

ninex = \[\]

niney = \[\]

eightx = \[\]

eighty = \[\]

sevenx = \[\]

seveny = \[\]

use_item(Items.Power)

use_item(Items.Power)

for n in range(get_world_size()):

		for n in range(get_world_size()):

plant(Entities.Sunflower)

if get_water() < 0.75:

use_item(Items.Water)

move(North)

		move(East)

use_item(Items.Power)

for n in range(get_world_size()):

		for n in range(get_world_size()):

if measure() == 15:

fifteenx.append(get_pos_x())

fifteeny.append(get_pos_y())

move(North)

elif measure() == 14:

fourteenx.append(get_pos_x())

fourteeny.append(get_pos_y())

move(North)

elif measure() == 13:

thirteenx.append(get_pos_x())

thirteeny.append(get_pos_y())

move(North)

elif measure() == 12:

twelvex.append(get_pos_x())

twelvey.append(get_pos_y())

move(North)

elif measure() == 11:

elevenx.append(get_pos_x())

eleveny.append(get_pos_y())

move(North)

elif measure() == 10:

tenx.append(get_pos_x())

teny.append(get_pos_y())

move(North)

elif measure() == 9:

ninex.append(get_pos_x())

niney.append(get_pos_y())

move(North)

elif measure() == 8:

eightx.append(get_pos_x())

eighty.append(get_pos_y())

move(North)

elif measure() == 7:

sevenx.append(get_pos_x())

seveny.append(get_pos_y())

move(North)

		move(East)

use_item(Items.Power)

for i in range(len(fifteenx)):

	goto.goto(fifteenx\[0\], fifteeny\[0\])

	fifteenx.remove(fifteenx\[0\])

	fifteeny.remove(fifteeny\[0\])

	harvest()

for i in range(len(fourteenx)):

	goto.goto(fourteenx\[0\], fourteeny\[0\])

	fourteenx.remove(fourteenx\[0\])

	fourteeny.remove(fourteeny\[0\])

	harvest()

for i in range(len(thirteenx)):

	goto.goto(thirteenx\[0\], thirteeny\[0\])

	thirteenx.remove(thirteenx\[0\])

	thirteeny.remove(thirteeny\[0\])

	harvest()

use_item(Items.Power)

for i in range(len(twelvex)):

	goto.goto(twelvex\[0\], twelvey\[0\])

	twelvex.remove(twelvex\[0\])

	twelvey.remove(twelvey\[0\])

	harvest()

for i in range(len(elevenx)):

	goto.goto(elevenx\[0\], eleveny\[0\])

	elevenx.remove(elevenx\[0\])

	eleveny.remove(eleveny\[0\])

	harvest()

for i in range(len(tenx)):

	goto.goto(tenx\[0\], teny\[0\])

	tenx.remove(tenx\[0\])

	teny.remove(teny\[0\])

	harvest()

use_item(Items.Power)

for i in range(len(ninex)):

	goto.goto(ninex\[0\], niney\[0\])

	ninex.remove(ninex\[0\])

	niney.remove(niney\[0\])

	harvest()

for i in range(len(eightx)):

	goto.goto(eightx\[0\], eighty\[0\])

	eightx.remove(eightx\[0\])

	eighty.remove(eighty\[0\])

	harvest()

for i in range(len(sevenx)):

	goto.goto(sevenx\[0\], seveny\[0\])

	sevenx.remove(sevenx\[0\])

	seveny.remove(seveny\[0\])

	harvest()

	for i in range(yyy):

		move(North)

else:

	for i in range(get_pos_y() - y):

		move(South)

r/TheFarmerWasReplaced • • 1d ago

My farm My first automated farm

Post image
25 Upvotes

I just built my first automated farm that is finally net-positive! I have no prior coding experience, so it took me about two hours to get here from scratch( game install) without using any AI. I’m really proud of this milestone, so I wanted to share it with you all. Do you have any tips or advice for a beginner looking to improve at the game?


r/TheFarmerWasReplaced • • 8d ago

Heelllpppp Prevent maze measure error due to multiple drones

1 Upvotes

So i have been trying to optimize my maze stuff by adding multiple drones. However, there has been a problem i have not been able to solve. Sometimes i get this error message:

I assume this happens because one drone solves the maze and one drone tries to measure the ground (now grassland instead of hedge) right after. Is there a way to prevent this from happening? I have tried adding If statements, but it still happens occasionally.


r/TheFarmerWasReplaced • • 9d ago

Question question abt polyculture

3 Upvotes

why is it that after a while of my code running plants just don’t want friends anymore? like i’ll have quick_print(get_companion()) and at first everyone wants a companion and then almost every line is just None. i checked its info page and it didn’t say anything abt this. why are my plants so lonely please help.


r/TheFarmerWasReplaced • • 11d ago

I am so proud of myself.

Post image
51 Upvotes

I went from knowing nothing about Python, and extremely little about coding in general, to what I have in the screenshot.
I started with 1 window with a long code that harvested different stuff and now I can harvest stuff with multiple bots and solving 3 simple mazes with the "left hand on wall" technique.

Just wanted to share and show it.

This game is awesome.


r/TheFarmerWasReplaced • • 12d ago

Question Sunflower farm

7 Upvotes

I have my first sunflower farm code, I was curious if there is anything glaringly bad for why I shouldn't use this?
I don't love getting stuck waiting on a singular largest flower, but not sure how I could better than my current "if I can't harvest this highest flower, look for a different one" that I have going on.

petals = []
while num_items(Items.Power) < 5000:
  for i in range(get_world_size()):
    if get_water() < .5:
      use_item(Items.Water)
    if get_ground_type() != Grounds.Soil:
      till()
      plant(Entities.Sunflower)
      petals.append(measure())
      move(North)
    else:
      plant(Entities.Sunflower)
      petals.append(measure())
      move(North)
  move(East)
  highest = 15
  while len(petals) == 36:
    if num_items(Items.Power) > 5000:
      break
    for i in range(len(petals)):
      if petals[i] == highest:
        x = i // get_world_size()
        y = i % get_world_size()
        goto(x,y)
        if not can_harvest():
          continue
        harvest()
        if get_water() < .5:
          use_item(Items.Water)
        plant(Entities.Sunflower)
        petals.pop(i)
        petals.insert(i, measure())
        if measure() == 15:
          highest = 15
      if highest not in petals:
        highest -= 1

r/TheFarmerWasReplaced • • 13d ago

Help needed on Treasure Map

3 Upvotes

Hello all! I've been trying out the new DLC, and I've gotten pretty far. Today, I've been trying to code a solution for the "Treasure Map" puzzle, and the game is being weird.

So, my drone is fine at all of the setup processes. It can find its way to the treasure map and read it, then start the maze. However, whenever I start the maze, it's weird. With the seed I'm using for testing, the first motion is "d", for "dig" I assume. Then, it's about ~15 W's in a row, but whenever I move west that many times, the maze breaks.

I'm not sure what's going on, but it's weird. As far as I know, the drone just digs down and goes west a bunch of times, but the maze keeps breaking when I attempt to do so. Do y'all have any guidance?


r/TheFarmerWasReplaced • • 13d ago

Update idea Iron and Quartz Prospecting should be affected by hover height

1 Upvotes

It just kind of feels like a missed interaction to me. If prospecting returns the direction or distance to the closest ore block, then which one is closest intuitively feels like it should depend on the vertical location of the drone too.
Also, that would fix a major problem with my current iron and quartz mining algorithms, just for full disclosure.


r/TheFarmerWasReplaced • • 13d ago

Does anybody know how to get the golden carrot, golden pumpkin, golden tree, and golden gold hat?

4 Upvotes

r/TheFarmerWasReplaced • • 14d ago

Why isn't this measure() working?

2 Upvotes

I know there are better ways to do it, but i only want to know what i have wrong with this syntax

for i in range(12):
  if measure() > 10:
    harvest()
    plant(Entities.Sunflower)

r/TheFarmerWasReplaced • • 14d ago

Question Am I missing something with Fertilizer?

2 Upvotes

I made now a Polyculture code. 32 drones working independently.

For grass no problem.
For wood and carrots, or I need to wait for them to grow, or I need to use fertilizer. But the production of fertilizer cannot keep up with the usage.
Are the upgrades from polyculture, in the future, going to compensate the time waiting for plants to grow?

Or am I missing something?

cheers


r/TheFarmerWasReplaced • • 15d ago

Bug report/support Is this a bug? (Issues with measure() wearing Dino hat)

Thumbnail
gallery
0 Upvotes

Hello world!

Os: android

Device: Samsung galaxy s24

Game version: mobile 1.1.32 (21)

Im new to the game and trying to get the Dino running and I mostly have. With one main hold up that seems pretty consistent of where my code crashes.

When the Dino is headed south and it collects an apple and it goes to measure the new apple which is directly east (same y) then it fails to compute x, y = measure()

Is this a bug? Am I doing something wrong?


r/TheFarmerWasReplaced • • 16d ago

Question multiple drones

Post image
4 Upvotes

I'm havine isusses with my code, the last drone doesn't go untill the fist one desponse. I'm not sure what to change. I'm very new to this.

ignore the fertiliser, I ran out and didn't want to take it out of the code


r/TheFarmerWasReplaced • • 16d ago

Dino thing pt.2

3 Upvotes

Some of you gave me amazing tips that helped me out so thank you first of all.

Some of you told me that having the snake initially chasing the apple and then after a certain length start zig zagging so I coded it and it works amazingly (unless it gets boxed)

I was working on a reset code but I can’t understand why it fails, pls help 😭😭


r/TheFarmerWasReplaced • • 17d ago

Program your Rats and watch them Fight [AD]

6 Upvotes

Hey everyone!

I asked one of your mods if I could share my game here because I figured people who enjoy The Farmer Was Replaced might actually be into this.

I'm solo developing Ratiator, a game where you program your rats' combat tactics in a simplified visual programming language best compared to unreal blueprints (and for the more technical folks out there MatLab) and watch them try to survive in the arena.

There's a free browser demo here: https://akandogames.com/play/ratiator/

Steam Page: https://store.steampowered.com/app/5335480/Ratiator/

I'd really appreciate some honest feedback from people who have not actively been involved in the development of this game because I'm ... pretty biased

I'm also looking for a few testers for the full game, so if you're interested just let me know!

Thanks :)


r/TheFarmerWasReplaced • • 17d ago

Dino bones thing

28 Upvotes

I never coded before and I saw this game so I thought it could be nice to learn but I think I’m kinda brute forcing it. I coded this for the dinosaur and I’m kinda proud about it. I’d really appreciate some advice and a bit of help since I can’t figure out how to make it a loop by swapping twice the hat and resetting the positions (I have multiple codes)


r/TheFarmerWasReplaced • • 17d ago

Code idea I know how to communication between drone

Thumbnail
youtu.be
8 Upvotes

So in this video, 4 purple hats drone place block representing a bit string eg. '110011" and 1 reader drone read it and print it out

red indicate 1 while green indicate 0

the bottom most column represent area reserve for flag

these are the flag

green -> not written yet -> reader can skip reading the bits

blue -> writting -> reader can skip reading the bits

red -> written -> reader has to read

Here is the code

def topos(x,y):

`cy = get_pos_y()`

`cx = get_pos_x()`

`while(cx != x):`

	`if(cx > x):`

		`move(West)`

	`else:`

		`move(East)`

	`cx = get_pos_x()`

`while(cy != y):`

	`if(cy > y):`

		`move(South)`

	`else:`

		`move(North)`

	`cy = get_pos_y()`

def writer_job(args):

`change_hat(Hats.Purple_Hat)`

`col = args[0]`

`nflip = args[1]`

`bit = args[2]`



`for i in range(0,nflip):`

	`do_a_flip()`



`topos(col,0)`



`place(Grounds.Block_Blue) # this tell reader that , the drone is writting`



`for j in range(0,len(bit)):` 

	`topos(col,2 + j) # writting field start at j = 2`

	`if(bit[j] == '1'):`

		`place(Grounds.Block_Red)`



`topos(col,0)`

`dig()`

`place(Grounds.Block_Red)`



`return`

def reader_job(args):

`change_hat(Hats.Green_Hat)`



`print("Hello, i am a reader drone")`



`num_writer_drone = args[0]`

`ex,ey = args[1]`

`bit_string_length = args[2]`



`bits = []`

`num_has_not_read = num_writer_drone`

`# bit prefill with 0`

`for d in range(num_writer_drone):`

	`tmp = []`

	`for b in range(bit_string_length):`

		`tmp.append(0)`

	`bits.append(tmp)`



`while(num_has_not_read != 0):`

	`for i in range(0,num_writer_drone):`

		`topos(i,0)`

		`if(get_ground_type() == Grounds.Block_Green):  # drone i is not writting yet`

continue

		`if(get_ground_type() == Grounds.Block_Blue): # Writting but not finished`

continue

		`if(get_ground_type() == Grounds.Block_Red): # finished writting -> read`

for j in range(0,bit_string_length):

topos(i,2 + j) # writting field start at j = 2

if(get_ground_type() == Grounds.Block_Red):

# read as 1

bits[i][j] = 1

#else 0 but we dont have to assign that cuz we prefil with 0 before hand

num_has_not_read = num_has_not_read - 1

topos(i,0)

dig()

`topos(ex,ey)`



`for d in range(num_writer_drone):`

	`bit_str = ''`

	`for b in range(bit_string_length):`

		`bit_str = bit_str + str(bits[d][b])`

	`message = "Drone " + str(d) + " wrote " + bit_str`

	`move(South)`

	`print(message)`

ws = 10

bit_string_length = 6

num_writer_drone = 4

set_world_size(10)

for i in range(0,num_writer_drone):

`topos(i,0)# reserve for flag`

`dig() # you need dlc for this`

`place(Grounds.Block_Green)`



`for j in range(2,2 + bit_string_length):` 

	`topos(i,j)# reserve for bit information`

	`dig() # you need dlc for this`

	`place(Grounds.Block_Green)`

bits = ["110011","101010","100010","001100"] # message for each writer drone to write

writer_drones = []

num_flips = [1,6,2,8]

topos(8,0)

reader_args = []

reader_args.append(num_writer_drone)

ex,ey = 6,6

reader_args.append((ex,ey)) # position where to print result

reader_args.append(bit_string_length)

reader_drone = spawn_drone(reader_job,reader_args)

topos(0,0)

do_a_flip()

do_a_flip()

for i in range(0,num_writer_drone):

`topos(i,0)`

`writer_args = []`

`writer_args.append(i) # assigning columns`

`writer_args.append(num_flips[i])`

`writer_args.append(bits[i])`



`writer_drones.append(spawn_drone(writer_job,writer_args))`

for w_drone in writer_drones:

`wait_for(w_drone)`

r/TheFarmerWasReplaced • • 17d ago

My farm Underground Treasure - The farmer was replaced

Thumbnail
youtube.com
5 Upvotes

The main bottleneck for this puzzle would be that the instruction trend to give you a lot of loops, luckily, I came up with a way to remove those loop while looping the instruction string

Here is the percentage of the distance the drone actually moved over the distance it would move if it followed the instruction string naively

Actual_path_length : 929 , Actual_move_length : 15

travese only : 1.61 %

=======================================

Actual_path_length : 555 , Actual_move_length : 43

travese only : 7.75 %

=======================================

Actual_path_length : 170 , Actual_move_length : 60

travese only : 35.29 %

=======================================

Actual_path_length : 1216 , Actual_move_length : 24

travese only : 1.97 %

=======================================

Actual_path_length : 358 , Actual_move_length : 62

travese only : 17.32 %

=======================================

Actual_path_length : 203 , Actual_move_length : 85

travese only : 41.87 %

=======================================

Actual_path_length : 385 , Actual_move_length : 43

travese only : 11.17 %

=======================================

Actual_path_length : 387 , Actual_move_length : 87

travese only : 22.48 %

=======================================


r/TheFarmerWasReplaced • • 18d ago

Heelllpppp Left works - Right doesn't. Is this a bug or am I misunderstanding something?

Post image
6 Upvotes

VERDICT: MISUNDERSTANDING!

The right-side clone is passing the result of the pump_scan(x) function - not the entire function. It's running the first time in order to determine the result (which is None) and sending that as the argument instead.


Just unlocked pumpkins and I wanted to experiment with the limits of passing arguments into defined functions.

Shouldn't both of these codes operate identically? Because they don't. A few more details:

On the right hand side, the passed function runs exactly once, during the first iteration of the loop. Clearly that means the function is passed successfully through the funct variable, yet it just ignores the passed function on every following iteration of the loop. Everything else in the loop runs perfectly fine - just not the passed function.

I also tested this with pre-defined functions and got the same result. Additionally, the related "Higher-Order Programming" achievement didn't trigger using this method.

On the left hand side, I changed the formatting to match the guide and suddenly the function parsed every iteration of the loop, without any issues (and triggering the achievement). What am I missing here? Is it just a bug?


r/TheFarmerWasReplaced • • 18d ago

My farm Finally

8 Upvotes

I can finally buy this drill that is locked behind 12M dynamite

farming dynamite was pain tho until I coded the near perfect solution


r/TheFarmerWasReplaced • • 18d ago

My farm dynamite sweeper 32 by 32 grid - The miner was replaced DLC

Thumbnail
youtube.com
9 Upvotes

I had to repost because the body isnt showing the YT link

This solution took me 2 whole days to be able to implement this because there were more practical challenges than I ever thought

The idea is to formulate a list of equations based on the grid and formulate a matrix to represent the problem, then transform the matrix system to the RREF (Reduced Row Echelon Form) to derive safe or unsafe tiles from it.

However, the algorithm cannot handle pattern where it is really 50/50 chance to be safe or boom but it can solve most of the cases

Here the github link

https://github.com/MarT1AZ/dynamite_sweeper_v4

If this help you, pls give it a start or upvote. This will compensate for my current state of sanity. I had to debug it for 2 whole day. Soemtimes, output just didnt print completely for some reason and I had to keep digging for dynamite which took around 20 seconds average.

I will come back and do some explaination later if this get popular

Note : I did make some explainations but when I selected this sub to post on, it reset my draft


r/TheFarmerWasReplaced • • 18d ago

Anyone else getting dirt in dynamite layers occasionally?

3 Upvotes

Is it a bug or am I somehow causing this?

No idea how this could happen in the first place

Also leaderboard runs complete, so I guess it doesn't happen then?


r/TheFarmerWasReplaced • • 19d ago

Optimization 2.3 million gold per minute!

Post image
32 Upvotes

maze size: 8

drones: 32

maze level: max

Previously when I did this I only got gold at 1.3m/min. Now I did it with high supply of power. The checkerboard positions will ensure every tile is possible in one step for each drones, and the speed of each drone contributes to the time it takes to move and harvest. Faster drone, fast harvest!

#edited each Treasure gives 2048 gold
drone-based rated output. 614400 gold, 16.26s Prints everytime a maze is spawned and the 300th treasure is harvested.

#here's my code

import main

set_world_size(8)
clear()

def toggleIt(pols):
# 	print("yeaaaaash")
	use_item(Items.Weird_Substance,pols)
	
def backNforth(fw,bw,pols):
	move(fw)
	toggleIt(pols)
	move(bw)
	
def toNfroTreasure2(pols):
	if get_entity_type()==Entities.Treasure:
		toggleIt(pols)
	elif get_entity_type(North)==Entities.Treasure:
		if can_move(North):
			backNforth(North,South,pols)
	elif get_entity_type(South)==Entities.Treasure:
		if can_move(South):
			backNforth(South,North,pols)
	elif get_entity_type(East)==Entities.Treasure:
		if can_move(East):
			backNforth(East,West,pols)
	elif get_entity_type(West)==Entities.Treasure:
		if can_move(West):
			backNforth(West,East,pols)
def ahoy(substances,j=(0,0)):
	main.goto(j[0],j[1])
	while True:
		toNfroTreasure2(substances)
# 			use_item(Items.Weird_Substance,substances)
# set_world_size(5)
def easyTreasure():
	size=get_world_size()
	substances = size*2**(num_unlocked(Unlocks.Mazes)-1)
	that_cargo = []
	for x in range(0,size):
		for y in range(0,size):
			if (x+y)%2==1:
				that_cargo.append(spawn_drone(ahoy,substances,(x,y)))
	main.goto(size-1,size-2)

	plant(Entities.Bush)
	use_item(Items.Weird_Substance,substances)
	while True:
		t1 = get_time()
		au1 = num_items(Items.Gold)
		while (get_time()-t1) < 0.3:
			toNfroTreasure2(substances)
		if (num_items(Items.Gold)-au1)==0:
			harvest()
			main.sleep(0.2)
			plant(Entities.Bush)
			use_item(Items.Weird_Substance,substances)
			
if __name__=="__main__":
	easyTreasure()

r/TheFarmerWasReplaced • • 19d ago

Heelllpppp I am once again stumped, but I feel so close.

Post image
8 Upvotes

The nefarious pumpkin farm. So, I am able to plant the whole world, do an initial pass checking for dead pumpkins and replanting.

Where I am having issues is trying to store the data for where there was a dead pumpkin. currently I'm doing that with:

x = get_pos_x()

y = get_pos_y()

MydeadPumpkins.append(x,y)

Then while my list is True or contains data, I'm trying to pop the list to generate inputs for my move_to function. The error I keep getting is that my move_to requires 2 arguments (x, y). I am not understanding how to pull that from my list.

Edit to say I would prefer hints over the straight answer. Trying to learn what I am doing wrong.