The thing about the economy is that we're all part of it but "nobody" really understands it.. (By the way, the world is held together with tape and glue stick, if you haven't already noticed in the past six months).

There's a lot of noise from both political sides about what the right move is for the economy. There's a lot of buzz words like "free market" and "capitalism" and "socialism" and "communism" and "taxes" and "trickle down economics" and——Yeah. It's a complicated system. Let's just dive into what the effects of a simple economy would look like.

Upon each tick of our simple economy, our turtles will have a variable to keep track of how much money they have. They'll each start off with $100. After each iteration of go, turtles will make a transaction. They'll decrease their own money by some amount and then give it to another random turtle. That's it. It's an extremely simplified model, but let's see what effects this simple rule has on our system as a whole.

Here's our template:

Setting Up

Today is going to be one where we can begin assessing how comfortable we are with NetLogo and coding. It'll be pretty free-reign, so if you want to jump ahead, feel free. Otherwise, I'm going to work at a slower pace to help out our peers that need some extra support.

In our setup procedure, set the turtle size to 2, the color to green, the shape to "circle", and their money to 100. Our "world" for this model will look more like a visualization based on our turtle's money. To create this, we're going to use setxy money random-ycor in our setup as well (in the ask turtles [ ]).



You'll see that we introduce a new command here: let. This defines a local variable, something that we'll use within a procedure or a [ ] block. It's super temporary, but it can help us save some data that we'll need to use in other parts of the procedure.

Here, the use of my "cost" variable is necessary. Since random 5 will give me a random number every time, we want to ensure that the first value that we got from random 5 will stay consistent throughout the transact procedure. If we don't "save" this number, we would keep getting random numbers and would get some funky coding behavior.

let cost random 5 will pick a random number [0, 5) and then save it to cost. If random 5 reported 4, we would save that 4 into cost. Now, every time we use cost, we'll get 4.

Now, we'll need to use cost to do a couple of things:

Once we've got this, we're good to go on our transact procedure!