[MUSIC] With this level of simplicity, we can now dive in into some code. Okay, so let's program this up. Our simple model of risky decision making, we're going to call that a complicated problem. And in every complicated problem, you break it up into simpler and simpler and simpler parts. So the very first thing we're going to want to need is a random number generator. I'm allowed to type commands down here. So for example, 1 + 1, what does it become, 2, I just hit enter and I got the answer 2. I'm going to pull this up and we'll see our whole history, if I type the word random, random as a function when I hit random space number two, I'll get two random numbers civically 0 and 1. I'm going to hit up arrow enter, up arrow enter and I rerun this command every time we do up arrow enter, and we generate random numbers 0 1 0 1. We're going to want the random numbers 1 through 10, so let me write random space 10. Run that a bunch of times, [INAUDIBLE] random numbers. You're going to find, it just gives you the numbers 0 through 9, I'm never actually going to get the number 10. Random numbers one through 10 instead of the numbers 0 through 9, as they're coming up, all I have to do is take whatever number comes out a random and add plus one. So now we're going to get, so this little one random 10 plus 1, that's going to give us our numbers 1 through 10. All right, that's our risky choice. Now let's cut up our safe choice. Our safe choice is going to be the numbers 7, 8, or 9. Three numbers. So, I'm going to take random, three and, of course, I'm only going to get the numbers 0, 1, and 2. So given the number is 0, 1, and 2, how do I get the numbers 7, 8 and 9? Well let's add 6, and then if I run that up enter, up enter, up enter, that was wild. We get the numbers 6, 7, 8. That was my mistake. Now we add 7, we go from number 7, 8 and 9. Okay. What do we do next? Now we're going to move into code world. And I just want this exact same code, do the exact same thing, but now, not in this command center, but in real code. So maybe you already know, that we have our basic boilerplate. I'm going to write, to go end. And this is a simple function, right now it does nothing. A simple function. It's a simple bit of code that's supposed to do something. And every time I press the go button, go, okay. It's going to do it. So if I hit go, I just ran the go code. Everything that's in go, nothing's in go, I can make something be in go. Let's just show the number three, okay? Enter, I hit go, what happens down here? Down here, the number three appears. Go go go, fantastic we're getting closer. We're slowly building something out of nothing. I'm going to want to We're going to create two numbers. I'm going to create these two numbers that could mean anything. This is just boilerplate code up top and what that means is that when you learn a language you just learn the stuff you sort of type all the time. One thing you just type all the time is the word globals. One thing you type all the time is to go and end, and in here I get to type anything I want. I'm going to type riskybet, and I'm going to type safebet. And these are just going to be holders, these are containers that I can put anything into. The way I put stuff into them is with a command called set. So if I set riskybet to say hi, and then I just show riskybet. Now when I hit the go button, I'm going to run everything inside these two lines of code. So I'm going to go back to my interface, I'm going to hit go. And it's going to say hi, and if I set riskybet to be something else, more old fashioned hi, then I'll get that. So we're slowly building up from, you just learned about functions, you just learned about variables, but more importantly you're watching how someone builds up from nothing to something. And you don't have to understand everything, you just have to follow the basic arc, the basic story that we're building up. So now, I'm going to take a big leap. Remember that code you wrote before? random, 3 + 7, that's our, no, no. Random numbers, that's our safebet, we're doing our riskybet now, so 10+1. Now I'm going to add my safe bet. Set the safebet to random 3 numbers + 7. And If I show riskybet. Now I hit go, I'm getting 4, I'm getting 7, we're not even using. So these are numbers, if you keep running this long enough, we'll see we're getting all the numbers 1 through 10. Because even though I said safebet to mean something I'm only showing the one thing I defined over here, I'm showing riskybet. Now we're going to add an interface element. It's pretty ugly to be looking down here all the time. I don't want to do that. So I'm going to pick something called a monitor. And a monitor gives me a view into anything I want. I want this to always have whatever value is in riskybet. And I'm going to make another that always has whatever value is in safebet. All right. So now, everytime I hit go. And I'll go back to my code, I don't need this line anymore, this show? We're not doing that anymore, we're just setting riskybet to a number, we're setting safebet to a number, okay? And if I hit go, every time I hit go, I redefining those variables and setting them to a new numbers. Let's look for some patterns here, which one tends to be bigger? To me, it looks like safebet tends to be a bigger number.