Getting Started With Farmtronics
Published: 2023-08-12 12:41:34

---
title: Getting Started With Farmtronics
published: true
date: 2023-08-12 12:36:50 UTC
tags: 
canonical_url: https://midsubspace.hashnode.dev/getting-started-with-farmtronics
---

Stardew Valley, a charming and beloved farming simulation game, has captured the hearts of gamers worldwide since its release. The game offers an idyllic escape into rural life, allowing players to cultivate crops, raise livestock, and build relationships with the town's quirky residents. However, if you're seeking to breathe new life into your virtual farming endeavors, look no further than the Farmtonics mod. In this guide, we'll take you through the steps to get started with the Stardew Valley Farmtonics mod, a fantastic addition that introduces exciting elements and enriches your gameplay experience with the power of programming and robots.

We have gone over how to install both the Mod API for Stardew Valley and the [Farmtonics Mod](https://github.com/JoeStrout/Farmtronics) itself. But what about once you load the game for the first time?

First, you will want to go over to the tv in your farmhouse

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841646046/d0e2183b-22f9-41b1-a90a-79783ca2b708.png)

and select the Farmtronics Home Computer

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841669914/bf094bc6-8ad6-4095-ab65-faaccd5f7b99.png)

Then in the main terminal type todo

This will bring up the to-do list which you need to complete to get your first robot.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841725387/ab5ce556-9739-4876-843c-10ec21b28558.png)

The rest of this post will be going through the to-do list.

# Printing Hello World

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841796088/729b3dd8-dd24-4770-a280-601c2e096eb9.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841810544/b32b8f1f-58af-45cf-b83e-2bc9fe8ce565.png)

# Moving Directories

the next item is to cd to another directory or folder on the computer. Farmtronics does not use your actual computer folders but its virtual folders. you see the root or first folder in the file system run [dir "/"]

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691841959089/b6a1e75e-d227-48cc-96be-c59268e508d4.png)

cd stands for Change Directory and with MiniScript which is the programming language used by this mod you need to have quotes " around the file or folder name so we will run [cd "/sys/"]

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842069463/7cf34a1d-8534-4565-9f91-09ccee26bd2d.png)

To make sure it worked you can run pwd which will show the folder you are currently in.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842108829/c0da1700-3813-405f-af59-3539dc852bca.png)

# Running the first program

Next, we need to run a demo which is located at the path "/sys/demo"

so we will do [cd "/sys/demo"]

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842151357/406b21e4-af44-4f98-a032-2d9fd921b0db.png)

then we will load the dogYears.ms program [load "dogYears.ms"]

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842194787/1d2e66b4-3cdb-4029-9694-0a2eb1ddc4e8.png)

then use the run command to run the program

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842226694/0a2ce80c-9bac-4d4b-916d-a648a322148d.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842265292/cc0d45dd-d132-4497-9952-1e8d7396624c.png)

# Editing and Saving A Program

Next on the list is to edit and save a program to do this we will first run [cd] which will take us to our main folder and then just run the [edit] command to open the dog years program and then you can just add a space to the first line.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842401523/6d2b3e0d-513f-4888-988e-cffae1a161c7.png)

then hit Ctrl+Q to exit the editor window. and type save "test" to save it in the /usr folder

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842441707/e053a300-0861-4e45-b6e9-8fe3b025747b.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842469146/2059d9fd-0aac-4b57-a666-d9a4a87197b3.png)

# For-Loops and Counting To 100

Next, we will be writing our first program which uses a for-loop that will print the number 1 through 100.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842804969/29a8514d-620c-4f80-9590-491fc246744a.png)

the first line says for every number that is within the range of 1-100 it should print that number on the screen

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842879078/f8093ca6-bcff-470c-885c-da1c65c50575.png)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691842901372/e0cafbed-9bbc-4d39-b11e-fe4cde10ae60.png)

For this last one, I am not going to show any code for theFizzBuzz program

# FizzBuzz: The Last Step

Per the request of [Joe Strout](https://www.linkedin.com/in/joestrout) creator of MiniScript and Farmtronics "_One thing I ask, though: don't give away the solution to the FizzBuzz task. If somebody can't get through that, they're only going to get frustrated trying to program their bots. So, that's an opportunity for somebody to slow down and check their understanding._"

**What is FizzBuzz?**

FizzBuzz is a programming puzzle that appears deceivingly simple but carries a hidden complexity. The goal of FizzBuzz is to generate a sequence of numbers while applying specific rules. These rules dictate that for multiples of 3, the word "Fizz" should be displayed, and for multiples of 5, the word "Buzz" should appear. When a number is a multiple of both 3 and 5, the program combines the two words into "FizzBuzz." For all other numbers, the program prints the number itself.

**The Intricate Steps**

Let's embark on the journey of showing a little peak behind the curtain of the FizzBuzz challenge without giving away the exact solution:

1. **Number Iteration** : Begin by iterating through a range of numbers, starting from 1 up to a specified limit. As we did with the above for-loop of 1-100

2. **Divisibility Checks** : For each number in the range, you'll need to perform checks to determine whether it is a multiple of 3, 5, or both. Can be done using somewhat basic math

3. **Output Rules** : Depending on the divisibility checks, decide what output to display. Remember, the rules are: "Fizz" for multiples of 3, "Buzz" for multiples of 5, and "FizzBuzz" for numbers that satisfy both conditions. For all other numbers, the output should be the number itself. One way we can do this is by using "if-then" statements

4. **Printing** : Print the determined output for each number, following the established rules. As we did when printing Hello world!

5. **Loop Continuation** : Continue iterating through the range of numbers until you reach the specified limit. As we did with the above for-loop of 1-100

**The Art of Problem Solving**

Creating the FizzBuzz program isn't just about coding; it's an exercise in problem-solving and logic. As you navigate through the steps outlined above, consider the following:

- How can you efficiently check for divisibility without resorting to repetitive code?

- Are there any patterns or conditions that can help you optimize your solution?

- How can you ensure that the program handles all possible cases correctly?

**Experiment and Refine**

Coding, like any skill, improves with practice and experimentation. Don't hesitate to experiment with different approaches and iterate on your code. You might find more elegant solutions or discover unique ways to tackle the challenge.

If you need further help you can check out the [Miniscript Manual](https://miniscript.org/files/MiniScript-Manual.pdf) or the [Quick Reference Guide](https://miniscript.org/files/MiniScript-QuickRef.pdf). You can also connect with the Miniscript and Farmtronics community on both [Discord](https://discord.gg/kmmR2Ze) and the [Miniscript Forums](https://forums.miniscript.org/).