This guide shows you how to program thoughts to move in straight lines, circles and to wander randomly.
You will need to have StarLogo TNG installed, to have completed the quickstart guide to using StarLogo TNG and Importing 3D models of Thoughts into StarLogo TNG.
What if thoughts could move around by themselves
How to Program thoughts to move in a staight line
It is easy to program Flunstellas in StarLogo TNG to move in a straight line.
In the Blocks window.
Get a ‘Forever’ block from the red setup and run drawer and place it in the Runtime page of the canvas.
In case you don’t know the canvas is the grey area to the right of the blocks drawers in the blocks window. Blocks are placed in the different sections of the canvas to create programs. If you put your different block programs in the right page, then it helps to make sense of your code. For example, you can put the code you use to tell StarLogo TNG what to do at when your project starts in the Setup page and the program to tell it what to do while it is running in the Runtime page.
The Forever block has a set of hooks for each breed you have in your project. If you place a block in a particular breeds hook in the Forever block, then every member of that breed in your project will carry out that blocks instruction twice a second for as long as the forever block is running.
Get a red ‘Forwards’ block from the movement drawer and place it in the hook (the gap) of the breed you want to make move.
In the SpaceLand window
Click on the setup blocks and the ‘Forever’ block. Make sure that the ‘Forever’ block is glowing green.
You should see your Flunstella start to move forwards. It will continue in a straight line until it hits the edge of SpaceLand and then it will turn around 45 degrees.
To change the speed at which it moves, change the number in the ‘Forward’ block and run the program again.
How to program thoughts to move in circles
To program your Flunstella to move in circles, place a red Right or Left block from the movement drawer underneath the Forward block in the hook for your Flunstella breed in the Forever block. Experiment by changing the number of degrees that it turns.
Circles are a bit more fun, but they are still fixed. Once you have set the program will continue to repeat the same movement over and over again.
How to program thoughts to wander randomly
To program Flunstellas to wander randomly, we need a new block.
Drag the number block attached to the Left block into the bin.
From the blue ‘Maths’ drawer, drag out a ‘Random’ block and connect it to the ‘Left’ block.
The ‘Random’ block generates a random number between 0 and whatever number it is given.
This means that instead of turning a fixed number of degrees every iteration (every step of the program), our Flunstella will turn a random number of degrees between 0 and 10. Imagine the computer rolling a ten sided dice every time it is going to turn left.
The higher number that you feed into the ‘Random’ block the more varied the result will be. Imagine the difference between trying to predict a coin flip and trying to predict a 10 sided dice roll.
If you give your Flunstella instructions to turn a random amount left and then a random amount right it will carry out those instructions in turn. This will give you a more balanced random walk, with your Flunstela wandering left and right. Experiment by feeding different numbers into the ‘Random’ blocks for ‘Left’ and ‘Right’ movement blocks.
To achieve the same effect with fewer lines of instructions you could program a ‘Left’ or ‘Right’ block using a combination of positive and negative ‘Random’ numbers.