Picking Peaches With Python in Animal Crossing New Horizons
By: Arthur Wilton
Tags: Python, Nintendo Switch, Animal Crossing Switch, Animal Crossing, Github

Getting Started

Before running ACNH Automator, you will need to input some information about your tree grid and where Nook’s Cranny is located in your town. In a future release this information will be entered into a command line prompt when running joycontrol, but for the current release you must edit the run_controller_cli.py file.

On line 63 of run_controller_cli.py you will find tree_pick_data being defined as an instance of the TreePickLogic class. It is populated with sample data that you will have to change. There are also secondary defaults that are defined, which can be updated as necessary. I’ve included a full explanation of each value you will have change in the Readme, but I’ve also included some reference images to clarify how the grid system is set up.

Grid Information

ACNH Automator v1.0 assumes that your trees are spaced exactly one grid space apart from each other in the x and y direction. Options for updating this will be available in a future release. Grid space is measured in [x,y] and assumes that [0,0] is the space directly to the left of the top-left tree. The nook_grid value should be exactly 2 spaces below Nook’s Cranny to avoid running into the building by accident.

Other recommendations

You MUST make sure that your inventory selector (the hand icon when you’re in your inventory) is located on the first inventory space, or the selling process will not work properly.

I also recommend clearing out your inventory of anything you don’t want to accidentally sell until you are very comfortable with this toolset.

It’s important to have Nook’s Cranny located as close as possible to your tree grid in order to make traveling to sell your fruit easier.

I recommend separating your tree grid from the rest of the town to avoid the possibility of villagers getting in your way, I solved this by building on a cliff that is inaccessible to villagers.

Try to only have one space available on either side of your tree grid, this will help your character “get back on track” if the automation goes awry.

Once you’ve entered your town’s data into run_controller_cli.py you can navigate your character to grid space [0,0] and move on to the next step.

Emulating the controller and running “pick_trees”

ACNH Automator relies on joycontrol to run, so you’ll need to first navigate to the Change Grip/Order menu on your Nintendo Switch, run joycontrol to begin emulating a controller, and then navigate back to Animal Crossing before running the pick_trees command.

To start this process, cd into the main joycontrol directory and run the following command:

sudo python3 run_controller_cli.py PRO_CONTROLLER

Here is an example of what running joycontrol will look like. You might have to hit CTRL-C once or twice if it doesn’t connect to your Switch within a few seconds.

Once joycontrol is up and running and your character is at [0,0] facing the first tree, you can simply run the following command:

pick_trees

Running pick_trees should look something like this.

Based on the information you entered about your town, your character will:

Navigate through the grid, harvesting fruit from each tree in the x direction until it reaches the last tree in the row.

Travel down two spaces in the y direction to proceed to the next row, and change direction accordingly.

Stop picking trees when a threshold is met for the amount of fruit that can be safely stored in your inventory.

Travel to Nook’s Cranny to sell all of the fruit, and travel back to the next tree that needs to be picked.

Repeat this process until all fruit is harvested and sold.

Here is an example of what this process looks like in action: