In the cubic sandbox of Minecraft, players have many tools for self-expression and creating various structures, including "dream farms." For some players, aesthetics are not the priority, but efficiency – for this type of person, there is a technical solution.
Recently, a developer under the nickname Serranegra presented a project that offers a maximally optimized farm construction scheme. Artificial intelligence capabilities are used for planning.
The working principle is simple: the player provides the AI agent with information about the terrain and the desired crop (plant) – in response, they receive the optimal block arrangement to maximize production. In addition, the system will also provide proof that "nothing better exists." The "OR-Tools CP-SAT" model is used for operation.
For example, this is how the optimization problem solution for sugarcane looks (the "traditional" pattern is shown on the left, and the optimal shape on the right):
The problem is set taking into account game mechanics: sugarcane grows on a block adjacent to water; each water block occupies a cell itself and nourishes no more than four adjacent ones. Everything comes down to solving a covering problem with a conflict between the area for the plant and water.
If the player uses "water strips," they will get 54 units of sugarcane, meaning 66.7% of the land is used, while the proposed solution allows planting 61 sugarcane and uses 75.3% of the land, meaning an efficiency increase of about 13%.
However, with not all plants will the gain from the AI's proposed "optimal solution" be large; it may be absent altogether. The developer noted that his tool does not hide such situations and honestly reports on them:
The conclusion will not sound like: "always optimize," but like this: "In the case of sugarcane, the solver gives a few percent advantage compared to a thoughtful player; in the case of planting cacti – almost nothing; in the case of wheat – absolutely nothing. A trustworthy tool is one that tells you when it's better not to use it, and this is clearly demonstrated, not hidden as "+0.0%" somewhere in a table."
Serranegra published the source code of the "optifarm" project in open access on GitHub.