 illegally here Drink only drink water. We have water behind there So don't consume food and drinks here. We're gonna keep the place clean We will have a coffee break about three plus outside so you can have there will be some food and coffee and tea outside So the bathroom is you go out by that door you turn a left and then a left again to go to the bathroom and And another important announcement, I'm not sure if you know but Pokemon Go is here, and I'm really excited about it so I Think they just launched it today And I'm really excited to go out. I already have a charm and I'm just gonna never it up Okay, like the business Ladies ladies, okay, okay, we can talk more later later. Yeah So if you don't know what tag ladies is I'm gonna tell you so you can just pretend that you know We are a community led initiative to help women connect learn and advance as programmers So this is part of we usually do at the connecting part in the non technical events This is more of the learning part, but you're here to also mix and bingo just to learn from one another Okay, so there's a few things that we believe in so the first thing we believe that technology is here to do good I think it's amazing and we want to be a bridge between Woman and also the tech community because if you don't already know the tech industry is a very male-dominated one And we just want to create an environment where women can just come and learn Yeah, so having said that we are woman focused very not anti-man so that's why you still see man around So don't Please don't be like why are you here? You're not a woman. You know, just be nice and inclusive to everyone Okay so If you I hope you know like this is the pre bootcamp workshop, so it's not the actual Tech ladies bootcamp. I'll tell you more about what the tech ladies bootcamp is actually how many of you were here for the info session So I'm gonna quiz you what the tech ladies bootcamp is just kidding So we the tech ladies bootcamp is a 10 week program part-time so you don't have to quit your job And in this program, we will teach you how to how to code by having you create products for non-profits That and the product differs based on what the NGO needs. So you're only building what they need which is super practical So we this program is designed to help women with near zero background So if you're a pure zero, it's probably not for you And if you're already like a PHP programmer with a computer science background, this is not for you, too so we focus on Teamwork so each of you I mean the selected participants would work in groups of three to help one NGO To build one product and you will stay in that product for the entire 10 weeks So we ran a first batch already that the next upcoming batch will be batch two and in batch one Three of them has found software related internship and jobs of which two of them are here sing Tian and Kate Just wait Shine Yeah, so we we don't care where you're from you can be from Mars or like Pluto. We accept people from all nationalities So for this specifically for the bootcamp batch tool We will have five coaches helping five NGOs and that means five projects And it also means that we can have a 15 people the language that we are focusing on this time round It's on the Ruby programming language And yeah, you were expected to spend about 15 hours a week three to four hours Something like this were me like one and then we have it run to about five. Some people want to stay longer to seven That's also fine So it cost five hundred dollars to participate We did not do we don't do tag ladies for profit because 500 ship profit We but we need money to continue running all the events and stuff So we're going to charge this bootcamp, but full scholarship is provided for people with financial difficulties Okay, so this time round we will have five coaches. So Dragosh is actually here. He's over there in the center. He's also the head coach for today's workshop And the five NGOs that we're helping are here if I'm not blocking you If I am blocking you you can go to this website This is actually our group that you should already know and I'll strongly encourage you to join because that's where you can share your problems Technical problems that you're facing and someone else will help you really really quickly We also have the videos of the info section that we had this Tuesday So this will have all the videos of the NGOs and also the coaches that will be doing there will be participating in the next batch So how do you apply for this 10 week program? So to apply we will need you to finish a technical task before you can apply to the program and So that's why we're having this pre bootcamp workshop That's why we're here to help you with gain some technical knowledge in order for you to complete the task to eventually apply for the bootcamp So yeah, so this is the first workshop and then we will have two more workshops in the weeks to follow So here are some of the important dates you want to take you might want to take a photo if you don't already know these dates so Yeah, the pre bootcamp workshop and now we will release the technical task next week on Friday so you can start working on it Then the application period selection period actual boot camp and then we will all graduate So I did any questions about the boot camp or the pre pre boot camp workshops at this point of time If not, you can always grab me or yeah to grab me or you can email me Okay, thank you so much and we will now start the actual workshop proper. So before that All the assistant coaches can you just stand up and maybe wave so that people know who you are Okay, we'll just do like a quick introduction to say your name. We can start from She's Monica Oh, then she she quotes He also goes Okay, Justin Okay, cool. So, um, just they have a special name tag So as and when if you have any questions, which we will expect you to have have a lot of questions I think you have gone through the hardest part. I don't know for me installation is the hardest part I hate installation My installation guide is to step one locate programmer step two pass laptop over step three done So you guys have like done the hard part So in any case if you have any questions that you can't follow with the main coach Just raise your hand and one of the assistant coaches will get to you. Okay. So What's your gosh Okay I was panicking for a moment. Oh, what's the main coach? So he will get this workshop started Give him a round of applause It's just like my laptop Okay, what do you want to be? Oh, I could be here Okay Hi everyone, can I have your attention, please? Thank you. So my name is Grzegorz. You can call me Greg. I will be The teacher today. I will try to introduce you to the programming try to explain you what programming is and Uh, we will try to write some of your first computer programs today. I know that not everyone has finished installation yet So let's first check one thing Okay, so if you can see this screen The password is techladies.co just like the url of the website cco Okay, if you have this you click on this black icon here called terminal and in this new window You type ruby space dash v And if you see message like this Then it means that you're all set up Can you raise your hand if Yes, let me make this bigger This is the this is the password So whoever sees that message the ruby 2.3.1. Can you raise your hand? Whoever's ready Give me an instruction second Okay, look whoever has traveled whoever sees some error message. Don't worry about it. Just do something something different Uh Just go to your browser And go to this website called rebel dot it Okay, whoever has any problems, please just open google chrome and go to this url Sorry They can hear you If I have yes But it will take 10 minutes to install it. So let's just go to this website instead. Yes, let's not yeah She means Hey Okay, yes It's everyone set up does anyone has any more problem Okay Hello Okay, look if anyone has any problem if anyone can't get that That last screen that I showed just go to this website. It will work just as fine So that we can start so when you go there you should see screen like this With white part and then blue part if you see this then you're set up And we will use this instead Ladies that's you Okay, is there anyone that doesn't have this website open or that previous screen that I showed Okay, I'm good Okay, cool. We'll start if there is anyone that still has any problems Please ask your coaches and just before we start exercising Exercises they will they will help you So the plan for today's workshop Okay, so here are all the coaches that were already introduced And the plan for today's workshop is first to explain what is programming What does it consist of what what is this word? Then we'll introduce you to two things one is terminal that I will explain later And the next one is the programming language called ruby that we are All here using on our daily basis In the first step and this one will be the most fun. We will write a computer game It won't be beautiful. It will be actually pretty ugly, but it will be a real computer game And in the fourth last step we will publish our code online so that anyone can see the code that we wrote now I checked for the first time in my life a few days ago and I was preparing the workshop I checked what is the definition of programming and I didn't understand it So don't worry if this is seems magical if this is what I learned When when I started programming I probably wouldn't do it professionally ever So it says that programming is a process that leads from formulation of computing program to executable computer program but That's of course, that's that's the definition that you can find in insectopedia. So let's maybe ask What what what are the steps? What is programming in terms of steps? So the first step for a programmer is to understand what problem needs to be solved So everything that we want to program we form in a We form as a problem Even if it's just application for fun like a game we say that this game is a problem that we want to solve Then once we understand this problem, we can form the solution step by step and the last step Just the last step is actually writing code in selected programming language so Most of people would think that programming is only about writing code, but the most important is understanding what we want to do this is this is difficult because Computers do not think as humans. They are very simple machines and whatever we think of We need to be able to express it in a very simple steps that will be understandable for computers So this is an example requirement example problem that we want to solve This is a very famous application almost everyone who starts programming does it at first The application is called fees buzz And the problem is that we are going to go from number one to one to number 100 And for each number we're going to print some text on the screen If the number is divisible by three then we will say fees if it's divisible by five We write buzz and if it's not if it's neither then we'll just write the number So now we go to the steps So we say that okay, if it's number one Then then we need to write number one if it's number three then we write fees If it's number five we write buzz But what happens if it's number 15 because it's both we can divide it by three and five So this is understanding the problem before we didn't have this We didn't We didn't consider this case now We see that there is something that was not stated very clearly in the requirement So in this case we just write fees buzz because it's both we can divide both by three and by five So we just write these texts together Now once we understand the problem and we have the steps we write the code So program program written in the programming language can look like this This language is called assembler Very few people use it nowadays because it's so difficult for humans to read It's very close to how computers How computers work but not to how our human brain works So this program is actually not complete the programming assembler just this simple program goes further and further and further And further and that's it But this is not what what we write these days This was the way that people used to program in 60s and 70s and even then they try to build The they try to create programming languages that are closer and closer to how humans communicate So the second program is language written in uh, this language is called Erlang It was created in sweden in 80s and it's still used quite commonly So this is the full program. That's it. It's way shorter way more concise It's not very easy to understand if you don't understand if you don't know Erlang as a language But you can actually see something meaningful here You can see that when n rem so it probably means if it's divisible by 15 Uh, then then write fees bus if it's divisible by three then write fees And this is uh, so this language that is still used used quite commonly Now the language that we will be using today is called ruby and ruby is considered a very high level language Which means that is very far from the computer code and very close to the to the way that humans express their thoughts So this language is obviously obviously way simpler to understand We just say from number one up to 100 print fees if if a Which equals to to the number divided by three is zero So it's still not very clear what what is this a what is this b etc? But this is something that is way way easier to read even for me After years of programming. I prefer this because this is this is more natural for me. How how I how I read text That the same program the same problem can be solved in in various ways So in ruby you can write it in this way or you can write it in this way. This is obviously way more cryptic. This is Very difficult to understand, but it does exactly the same thing. It will print exactly the same the same output Now, uh, since we're all set up I will introduce you to terminal Terminal is a tool that all programmers use almost every day and this is It's kind of equivalent of using the whole operating system So when you use windows or mac os you've got all these windows that you're moving around that you can see folders and files with You can click on them. So terminal is something like this Except that it's based on the text. It doesn't have any graphical interface So let's open the terminal Uh, let me put the password Terminal is this icon here on the left the black icon and if you If you click on it, you should see something like this with this blinking white cursor Okay, everyone has this window. Uh, the people who are using the browser instead of this operating system The browser doesn't support it. So please just have a look at the screen of the person next to you So that so that you see you see the base and these basics later when we start writing program You will be able to do it in that browser. Uh, this part unfortunately needs to be done It needs to be done here. So first command that we will type is ls If you if you if you put ls and you press enter You should see a list of blue and white text like this So ls means list it lists the current directory So directory is like your home or your documents directory in windows And just prints its content on on on the screen index Okay So this is extremely simple way to decide to to determine what do we have in our in our directory Now we will create a new directory Where we will store our projects our our game today. So let's call it project. Let's put an mkdir space project Mkdir is like abbreviation for make directory And then when you press enter, you will actually see no output But if you put ls again You will see that there is this new object here called project that we didn't have before So in windows or in mkdir equivalent of doing that would be clicking with the right mouse button Press choosing create new directory and setting it name to a project Okay Now the next step is to go inside that directory This is done by a command called cd. It means change directory So we press cd And then projects and after you press enter You will see that Here you've got the path To this directory that you're in so it means that we are currently inside this directory And if you press ls You will see that there is nothing inside because we just created empty directory So now let's Let's create something in this directory the command to create a file is called touch And we can call file exercise one Now once again, there is no output, but if you press ls you will see that this file is here Okay Now if we don't want the file we use the command called remove which is abbreviated with rm We provide the name of the file that we want to we want to remove Press enter And then when we release the directory We have nothing because we We deleted that file Okay now Let's do our very very first exercise and this is what also people who don't have it who have the browser version Can do so we will open the This thing called sublime text. It's a it's a text editor that we will be using today I can't make it bigger. So I will just write in my editor instead, but you can just repeat whatever I write Okay, now let's Okay, let's put something like this puts And then space And in double quote write good afternoon in singapore even bigger. Okay Good enough Everyone can see it from the back You see this clearly Okay, then inside double quotes. Good afternoon singapore Okay, let me just do it in that vector as well. Okay now Now we need to save this file so just Put save and here on the left You choose tag lady and then choose project The directory that we just created And then as the name of the file, let's put x1 dot rb So now when you put ls No, it's not here Okay, so now when you do it and you put ls in your terminal You should see the file x1 dot rb for people who are using the browser version And for people who use the browser version just put it here Okay, everyone has it Not yet Okay, so for those who use the the browser version Now after you need to put you need to press this button play And this should write good afternoon singapore on the right side So this is how you will run programs in this version here in the browser And for those who are using this terminal version What you need to do is to put ruby space x1 dot rb and then you put enter and you should see exactly the same you should see good afternoon singapore Okay, so remember the way you are running your programs people who use the terminal Just use this way the ruby space name of the program And people who use the browser after running the writing the program. They just tend to press This uh this icon here. Okay. Is there someone that hasn't written it yet? Okay Uh Okay, so what you just did is we wrote the first computer program, the very very simple computer program. It was written in the language called Ruby and programming languages are kind of like human languages. It allows us to communicate except that instead of communicating with humans we communicate with computer with the language that they understand. So you know that these days we have lots of software that actually almost understands what we mean. There are lots of chatbots on Facebook that we can type to and there are even some machines that can understand our voice and recognize what we say. But we all know if anyone here tried it, you know that it's far from being perfect, actually very far. They cannot understand our accents, they cannot understand some slang words that we use and this is because computers are really really stupid. They are just trained with lots of data to understand even very basic sentence that we say. That's why programming languages are very strict. They have just a bunch of words that we can use because this is the way that computers will be able to understand it easier and faster. So for example if there is a word called if else, like two words if else, computers will only understand it. It will not understand otherwise for example or it will not understand unless. It will not understand all the synonyms that we have just because these languages consist of very very few words. So okay this is the game that we will write today but before we get to that game we'll write a few other simple programs that I will show you now. So anyone, everyone knows how to run the program that you write. Once again if you're in the browser after you finish writing you click on the play. In the terminal after you finish writing program you need to save it and then you need to write it using the ruby command. Okay so let's let's try to write something more useful. Okay so so the program we wrote in the previous step was basically useless right because what's the point of printing that hello Singapore on the screen. You can do it once and wow yeah I did it but then it gets quite boring. So now we will write some dynamic program. So the very basic way that programming languages were used was to perform some computation. They were basically like calculators. So right now in your file you can try to run some some basic some basic computations like you can do puts and then you can write 10 plus 40 or you can use different numbers. And then you can do the same but instead of plus sign you can use asterisks to perform multiplication. The third one slash is the division and the fourth one you will realize once you try it out. Okay so right now you don't need to use these exact numbers you can use different ones. Just try out and see what are the results. Check if the results are correct because there might be something surprising that that you wouldn't you wouldn't see this result coming. Okay so if I run this program right now I see some very huge number. So have you realized what is the operation? Yes exactly. So the last one this double asterisk means to the power up. So I will replace it with something shorter something smaller to see the other results. Okay so the first one was obviously multiplication was correct the first one was addition the second one was multiplication the third one we divide 40 by 30 but this is something unexpected here because the result is one but actually if you divide 40 by 30 the result will be different right this is one point three three three three. So this is something that we need to understand about computer languages that they do not understand what what we what we really mean unless we are very specific about it. So if we divide two integers in ruby like 40 and 30 it will think that we want the results to be also integer. So obviously then the result is one and then the 10 is the rest of that. Now here you see the next program that performs only division but what I changed here is that to the number I added 0.0 so you can try it out you can you can write something like puts 6.0 divided by 5 and then you will see that the result is a bit different no in this case it doesn't matter. Just try different ways and see what is easier for you to read that's yes because puts move to the next line if I do print it will just the next text will be added so it will be yes exactly yes okay so if you already did it you see that it returns you now the correct results if you add 0.0 to the number and this is because 6 and 6.0 are considered different numbers by a programming language 6 is an integer and 6.0 is a is a real number so it might be a number with a fraction and then if we divide two real numbers one by another then the outcome obviously will be the same time so it won't be integer however if we divide two integers like in the first line 6 by 5 the programming languages assumes that the outcome we want is also an integer sorry make it bigger or even more now this is the most that I can use my screen here yes because it also gets bigger okay now I want you to do something like this this is similar to what we did in the previous exercise we divide two numbers one is one is with 0.0 one is the integer but I want you to divide these two very specific numbers 130 and the reason I want to I want to do it is because you will see that the result is far from being perfect because the result is free and then we should have using the mathematical notation we should have free in parenthesis right so it means that there is an infinite number of these digits there but computer languages do not understand it they can't they don't get this concept of infinity so they just round the number so instead of x3 we just see 5 and this seems very useless like it's it doesn't seem important at all because well we've got like 20 digits here right and and only this one here is is wrong one but if you perform financial operations and you multiply this number by a few millions then it appears that that the error might be a few dollars and if you perform millions operations a day it basically means that all of your computational operations are incorrect so this is the first problem that programmers always meet that their numbers are rounded they are not perfect and this is something that we need to find workarounds for and the reason is that computers are just once again stupid machines that are that do not understand things like humans but they but they understand in a very very simple way so let's go to the next program now in the in the previous programs the only outcome that we saw was the number but what if we want to show some text and then the number after that for for this we use these weird characters here this weird syntax what it means is that the program will print the text 7 plus 12 equals and then whatever we put between these curly braces here will be executed will be calculated so the outcome should be 7 plus 12 equals 19 and this is what it returns but what is important here what you need to understand is that computer did doesn't doesn't understand that 7 plus 12 equals 19 it thinks of this part here just as a text so if you change this number to 15 it will still it will still say that 7 plus 15 equals 19 which is obviously incorrect right so these are two separate pieces of information this here between the quotes it's just treated as a text computer doesn't have any idea that it's a number it's just a text and what belongs what belongs here between these hash and curly braces this is that computer tries to understand as numbers okay the next thing we'll try to do is to reduce the repetition in our program so as you see here we say good afternoon to four different people and every time we need to repeat this text fully so this is something that is not very convenient because I don't want to type it all the time over and over if I want to say hello to four people so then what we will do is we will use a thing called function function you can think of functions in programming as as in mathematics you've got in mathematics you got I know you've got a logarithm function or you've got some trigonological functions these ones here are not so complicated the function that we use will just say good afternoon to the person whose name we provide here so start by writing these three lines of code sorry yes okay so these three these three these three lines here is just the body of the function if you only write these three lines and you try to run the program nothing will happen because we just wrote the definition of a function but didn't didn't call this function with any with any parameters so ruby syntax says that function starts with the word death which is a short for for definition then we've got the name of the function so this function is called say hello and then in parenthesis we we provide the list of parameters that this function will take so this function takes just one parameter and it's a name functions can take from zero to infinite number of parameters and now whatever stays between this this line that contains the word death and the line that consists only of the word and is is the body of that function and whatever happens next is is outside of this function so once once we write and our function is is done and now we can call it so in the next in the next line in line number five i call this function what so what i mean is that i want to call the function called say hello and ask the name i want to provide the gregor or baron or other names so try it out try to put your name see if if the output would be this text good afternoon okay everyone got there everyone managed to print this text is someone still working on that okay let's go further then let's let's try the next thing okay the next concept i want to introduce to you is variables variables are the things that we manipulate in our application so we assign some value to some to some name so in this case i have four variables the name age the variable called is smoker and is lazy and each of this variable has some time so the first one name the type of this variable is a text or as we call it among programmers it's a string it's a series of characters and then the age is the number and it's an integer you see it doesn't have dot and any number after that it's just an integer and the next two ones are so called boolean value boolean says you if something is false or true it's just it just accepts two values so number has infinite amount of possibilities it can be one it can be million it can be even bigger but boolean has just two values it's either false or true so now what what this program will do is that it will print some text with the included variables so this name here will be replaced with the value that we assigned before to name and the same with other ones so the output of this program will be just a single sentence that says how old i am and if i'm smoker and find lazy now what you can do is you can try to replace these values here with either different numbers or maybe even different type of the value so let's say that i provide that my age is no and now obviously no is not a value is not is not a valid number but if i run this program it will still it will still say that i'm no peers old so this is a thing that you need to be careful about because even if you think that the age will provide your number it doesn't have to be so so the name of this variable doesn't necessarily tell you what it contains so you can assign anything you want there okay before we start writing our game there is one more program that we will write and this one will be a bit difficult so i'll try to try to try to go slowly that okay so this program contains of a few more things a few things that we didn't introduce before so we'll start with the first one it's called a class class decide when we create a new class we are writing kind of like a new type for data so the integer or a string is a type of data and these are simple types but we will create something that is that is more more complex so we will create a class that will represent a person and now the method initialize tells us what happens when we want to create the object of that class of that type and in this case we want to get four different information the ones that we used in the previous program like name age if it's smoker and it's in the body of this initialized method you can see that we use these characters with the add sign in the front this will tell the class that we know that we want this this thing here to evade to be available also in the middle of this class if we do not use this character this name will be available only in this method it will not be available here later okay now what happens is that for this person we create a method initialize that will be run when we create a new person and then we add a new method a new function the function will is called describe and its goal is to put the basic information about that person and then once we once we finish this function with the keyword and and once we finish the class with keyword and we are outside of the scope of this class it means that this class is completed and now once it's completed we can use it so how we use a class is with the keyword new so we create a variable that is called monica and then we assign this object this person to this variable so we put person dot you and then we provide for arguments here separated with commas for arguments because this is the number of arguments that we that we decided to use in our in our class anyone needs help just raise your hand ah okay very well that belongs to this university. That's my idea. So, it's a level. We just get close to it and then I define what the strength might be when it's not there. So that's the image of this university. It's very specific to this university. So, is that kind of a sense? Is it that like... Yeah, I think it's the ideal. It's all the end of the general idea. It's one of those things that... I think I agree. I think it's important to agree with and that's what it is. I don't know why we're working with them. We're working with them. We're working with them. What is the thing that... I don't think it's a full sense. Programming. You know, I want to try new things. New videos. And then all the stuff. So, the beauty of this is that... there's a class that's useful. So, if I say one like... there's a key, right? Yeah, you can be planned for the day. Or what would be useful? I don't know. I don't know. It's because you're always... It's... It's useful. Oh! Whenever you see... Whenever you see... I'm trying to look at my... I think she said... I think that's what we're talking about. I think that's what we're talking about. I think that's what we're talking about. Oh, right. What is that? It's too much. Okay. Okay. That's this. Okay. What is it? Um... What is it? What is it? What is it? I don't know. What is it? It's the tape, right? No, no. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Umm... Okay. You don't have to look at it that way. You can do it that way. Okay. Okay. Okay. I don't know. Okay. The change sign is changed to a lot. It's not exactly the change. It means the change. The change sign is changed to a lot. Okay, everyone did it working. Someone still has problems. Okay, in a couple of minutes we will have a short break. So before we do that, let's do one more exercise. Okay, the last exercise before the break is introducing a conditional. Which means that we will print the text which depends on something. And we will do it in this new function that I added here. The function is called smoker with the question mark in the end. And the body of the function says that if this variable here, if this smoker is true, then we will put yes, the name is smoker. And else, in another case, it will put no, it's not a smoker. So this function will behave differently for different people. If in the person.new we provide information that yes, that person is smoker, it will print yes, otherwise it will print no. Once you add this method, you just go here and after you created the object called Monika, you can ask if she's a smoker. You just put Monika.smoker with the question mark. Try to run it and see what it does. It's just the name. This name can change the question mark. You can just use the same one. Yes. Usually you will use question mark when you want to ask something. When you want to return true autos. So like, smoker would be a question. Like, I'm asking if you are a smoker. But this part is not really a question. I just tend to describe it somehow. Right? But this is just a question. Normally the convention is that the method with question mark will return true autos as a result. Yes. So if you were not using that convention, I just wanted to show that you can ask question mark. Or you can ask the same question mark, also explanation mark. Try to run it. It works. Okay. Have you tried to provide it true? I said smoker. Yeah, it works. Okay, cool. Try to provide it true. Instead of true autos, try to provide it not true. It actually seems like that. Okay, whoever made it work. Now you can see that is smoker is our third parameter here on the list. Name, then age, then is smoker. And then what you can do is you can change the value that we put here in the third one in the order from false to true. And then you can write program and you can see what the program writes on the screen if it really changes or not. Chairman, can you check there? In the end someone wanted to explain that late in black what did happen. The one last. Can you check it? Okay. Okay. Ladies, so once you're done with this exercise, we have some coffee, tea and me and snacks. Really bad joke. Outside there, so you can just help yourself. We have like tarts and cakes and coffee and tea. So do know that if you want to get some snacks, you have to eat it outside instead of here. So you kind of have to choose if you want to continue here or you want to eat something outside. And we will come back from the break in 30 minutes. Thank you. Hello everyone. Hey, we're all back. Before we start with the next part of our workshop, which we'll be writing the game I mentioned at the beginning. We will just go quickly. I will go through all of the things that we introduced to rephrase and explain once again so that we're not lost because I know that there were a lot of concepts that I introduced. Don't worry about it. I know that it's all overwhelming because normally what you learn here is done in a few weeks or a few months of university when you study computer science. So this is very intensive course. And before we go further, I will just quickly remind what we covered here. So in our first program, we just used one function called puts, which prints the text on the screen. And the text needs to be inside the double quotes. In the second one, we printed some results of mathematical equations. So we covered the addition, multiplication, division, and then we realized that the double asterisk wins to the power of. Next, we covered the concept of integers and floats, which are the numbers with fractions. We learned that if we divide two integers, the result will be just integer without the fraction. If we want to have float, which means the number with the fraction as the result, we need to use this number with dot and then the fraction after that, even if it's zero. Next, we realized that the numbers on computers are not perfect because there is a rounding error because computers do not understand the concept of the infinite number of digits after the dot. What we did next, it's SoCorp interpolation, which means that inside the text, we put a hash and curly braces. Remember that this pair needs to be curly braces. And whatever happens, whatever we write inside, it will be calculated by the program. Next, we introduced the concept of function. Function is something that allows us to avoid repetition in our code. Instead of repeating the same phrase over and over, we can just create a function and then call it. Function contains three things. First is the definition, which starts with the word def, then there's a name of the function, and then in the parenthesis, we put the list of parameters that this function will take. The next part is the body of the function, which means what will computers do when this function is later called. And this function says hello, what it does, it brings the text good afternoon, after which it puts the name we provide, and they say, how are you? To call the function, sorry, the third part of the function is the word end. It needs to be there because without this word, the computer thinks that we are still writing the body of the function. And then after we finish it with the word end, we can call the function just by using its name. And then in parenthesis, we put the parameters that we want to provide to that function. In the next step, we introduced types. So now we know that computer recognizes different types. We have the string of characters, which is basically a text. It has a number, and the type called boolean, which is one of two values, either true or false. Also, we learned the concept of variable. I'm not sure if I pronounce it very clearly. Yes, variable. In breathing, they say variable. Okay, anyway, yes. So that's how I spell it. So variable. No, it's not natural. It's a name. It's something that we later reuse the program, and it's like a keyword. It's a name for some value that we want. So here we've got the variable called h, and it calls the value that is 42. Later, we can change this value if we want. Let's say that now, from this point, I want the h to be 50. And now wherever I use this h later, it will keep the last value. It will return the last value that I put there. Now, the next concept, and I know that this is the most difficult concept that we introduced, is a class. Class is a type. Think of it as a common description for multiple objects. So let's say you have multiple fruits. You have an apple that is a specific apple that you hold in your hand, and then you've got a durian that you hold in the other hand. And both of them are fruits. So the fruit would be here a class. You've got a class called fruit, or here in this case, we've got a class called person. And then me would be an example of this class. The example, the particular person, we call that it's an instance of this class. So here, in this line number 14, we create a new person, and we assign this person to the variable monica. And what class consists of is a bunch of attributes. We add these attributes in the initialized method. So when I call person.new here, what happens is that a new person is created, and then this function, the initialized function is called. So this function will basically say that we want to remember these four attributes. So again, these names, the name that starts with at, will be remembered for the whole person. If I don't have this name, and if I only have this one, this here, it will be forgotten as soon as this function ends. But I want to use this name here. I want to use it in another function of that person. Therefore, I need to use this at name. Now, once I create the new person and assign it to variable monica, I can call a function that this class, that this type person knows. And the function that we created is called describe. So then what I can do is I can write monica.describe. And it will return us the name, the age, and other information that we provide to this specific object. Later, if I want, I can put, I can create different person, say I call it Greg, and then I replace the information that I use here with another one. So that the class allows me to later use different instances. Let's say that I want to store information about all the dogs that you have in the shelter. My type would be a dog, and then all the dogs that I have would be represented by specific examples of this class. And in the last part before the break, we introduced this extremely useful thing that is called if-else. If-else is a structure in the language that allows us to execute different action depending on some condition. In our example, we checked if the person that we created is a smoker. And if it is, our function said yes, this person is a smoker. Otherwise, or else, it said no, this person is not a smoker. So this structure if-else consists of three parts. First is if, and then we put the condition. We want to check if that person is a smoker, so then we check the value that will have the true or false. After that, we say what happens if that condition, if this is smoker, is true. And the last part, the else, is optional. Else says what will happen if this language is false, if it's not true? When I'm saying that it's optional, I mean that I can delete it. And now, if this smoker returns false, basically nothing will happen. So it's the same as if I put nothing here. Else do nothing. So then I just don't need the else. So these are all the things that we covered so far. And now we'll go to this, where is it? Okay, now we'll do this. Now we will write a simple game. This game is a, we have a few different versions so that we will appear. Building it step by step. Each step will add something new to that game and we'll see how far we get. So the game is called Guess the Number. And at first, computer will pick a random number between 0 and 100. And it will ask the player, it will ask us guess what number I picked. And then whatever number we put there, the computer will say, okay, yes, you're right, you won. Or if we didn't pick the right number, it will say the one that you tried is too high. Or it will say the one that you tried is too low. And then, once we guess the number, the game will finish and we will be able to start once again. Okay, let's start with a very, very simple step. So for now, delete everything that you wrote so far, or you can create a new file or open the new window in your browser just so that we start with a very clean state. Okay, everyone's ready. Don't write this yet. Just start with a clear screen. I will first tell you what it means, all this here. And then we'll write it. So the first line is just printing a standard text, like we did in the beginning of the workshop. It will tell us pick number between 0 and 100. And then what we do in the second line, we create a variable called guess, and we assign to it the value called guess. Guess is a function that takes whatever we put on the screen, whatever we press on the keyboard. And then when we press enter, it collects that value and it will assign it to this variable called guess. And then in the third line, we just say, you pick the number and then we will print the number that user chose. So try to write it and then try to write this program and see if it really will print the number or whatever text you put. Whoever is done, you can try to run this program with the ruby command and then you see what happens. So if you run the program, it should tell you pick the number between 0 and 100. Then whatever number you put, let's say I choose 77 and I press enter, it says you pick number 77. Now you can try to play with it a bit, try to break it, try to put, I don't know, number A, which is obviously not a number and see what happens. Or put just empty line, just press enter and see what happens. So as you realize this program doesn't know that we didn't put any number or that we put number A or ABC, the program right now doesn't know that it is a number or it's not a number. It just takes whatever text we put and it returns it. What I changed in the end, what I changed is here in the second line, after the gets, I added dot to underscore i because my program doesn't have any idea that what I put should be a number or not, it accepts any text. So what I say by adding to i is I say convert whatever I put there to a number. And now you can try to run this program once again and try to put some text like ABC or your name instead of a number and see what the program will do. Everyone's following? Have you tried what happens? So obviously if I put a number here, it will say that I put this number. If I put ABC, then it says that I pick number zero. So if it cannot recognize the number, it will just think that it's zero. Now, however, we can do something more interesting. I can see what happens if I put one to three and then ABC. So my computer program was able to determine that the first characters of what I put was a number and then once the digits finished and the text ABC appeared, it just ignored it. So it assumed that if I say one to three ABC, that the number I want is just one to three. But it's not as smart as you would think because if I start with ABC and then one to three, it doesn't have any idea that there was one to three there. It just checks what it starts with. If it's a number, it tries to recognize it as a number. If it doesn't start with a number, just like, okay, I won't do anything, just try them. Now, if you put nothing, it will once again pick zero. And if you put a number with a fraction, let's say 35.9, it will just cut it to 35. Because when I say converted to I, I mean to integer, which means ignore anything after the dot. Ignore every decimal. Our game was until now pretty useless because it didn't do anything right. It just printed the number that we put. What we will add now is that our program will pick a secret number. So the first line, what I do here, is I create new variable. And to this variable, which is called secret, I will assign a number, a value of this function. So I called function called round. I did not create this function before. It is created in the Ruby language already. Round means random. And it will pick a random number up to the number that I provide as a parameter. Why I put 101 is that it puts number up to the one that I provide, but without it. Which means that if I put 100 there, it will pick a number between zero and 99. But what we want is between zero and 100. Therefore, we need to put 101 here. After we pick this secret number, we have the same as in the previous application. We ask user for their guess. We convert it to a number. And then in the end, in the last line, we once again said you pick this number and the secret was. And then we reveal what was the secret number. Okay? Everyone's following? This game is once again pretty useless because it only tells us what was the secret and what was our number. First, it doesn't give us any chance to improve our guess. And even if we win, it doesn't congratulate us. It just says you pick this number, secret was this, that's it. So here, in the next program, we will add these six lines, nine lines that you see here. So in the line number seven, we are using this if statement. We are using the if conditional. So we are checking if the secret number is bigger than my guess, then I will print your number was too small. In the next one, I check if secret is smaller than the guess, print your number was too big. And in the line number 15, we are checking if the numbers are the same. So as you see, we are not using the single equal sign. We are using the double one. Double equal sign means that we are comparing, that we are checking if two things are the same. Give some help, just raise your hand. Whoever finished writing this, try to run this program and see if it really works, if it really says that your number was too small when it was too small and otherwise. Has anyone tried running the program and checked that it works correctly? Okay, let me try my computer. So the output of the program should look like this. When you pick your number, it says you pick this number and the secret number was and then it reveals it. And then it says that your number was either too big or too small. I don't want to check the version where it says that my number was correct because I would need at least 50 tries probably, so we will skip it for now. We will go immediately to the next version. So what we did here is we just simplified our program. In the previous version, we were asking if secret is bigger than guess and then we write and then we check once again. If secret is smaller than guess and then we did the third try. But what we wrote then can be written in a simpler way. So we can remove those nine lines and just replace it with these. So what we are doing here is we ask once again if the secret is bigger than guess then put that number was too small. But on the next line, we are repeating the same condition but we are saying else if secret was smaller than guess. Please note that there is not else if, there is no second either and then we use the else and we have already tried before. So this is like if else but this is with three versions instead of two. Once you finish it and run this program, it should do exactly the same as the one before. The behavior shouldn't change. What we did is just we improved, we simplified the code so that it's easier to read. Has everyone confirmed that it works the same way? That it doesn't return any error? Okay, now we will add the new thing that we haven't learned before. This thing is called loop. And as the name suggests, it will just add the loop because until now we only asked once to pick your number and then we didn't give the player a chance to improve and to guess on the second or third try. So in this program we add only two things. We add loop, do in the third line and then we add end at the end of the program. The rest, what was between line number five and the end of the program remains the same. We do not change it. Have you tried running it? Does it really give you another chance to answer again and to pick number? That will come once everyone is done. Those of you who already run the program realize that it runs infinitely. Even if you pick the correct number it just tells you pick the number, pick the number. It never ends. So to end the program on your keyboard you need to press control, hold it and then press letter C. And then the program should stop. Once again, when you have enough of the program asking you to pick the number you just press the control which is CTRL on your keyboard. You hold it, then you press letter C and the program is done. And then once you run it again it should pick different number. But you can check that on the second try it should pick different number than on the first try. In the next step we just add one change. One small change. In line number 14 we put the word break. What it does? Break will break the loop that we are into. What we want to achieve is that in the else case which means that our secret is equal to our guess it will say your number was right and then it will break which means that it will automatically finish the program. We do not have to press control C anymore. The program should automatically close and we can run it again to play the game. So once again just to rephrase what we are doing here in this EVE we are checking if the number is bigger than if the number is smaller and then else which means that none of this is true if the number is not bigger and it's not smaller it's equal. That means that our number is correct. Now what we are going to do in the next step is we will move the part where we are asking user for a number to a function. So what we do is that here in the loop we had this line that says pick number between 0 and 100 and then we did secret guess equals gets to i. So we basically had this part line number 4 and 5 inside the loop. What we do right now is that we move it to a separate function which we call ask for number and then inside the loop in line number 9 what we do is that to variable guess we assign the result of the function that is called ask for number. Inside this function in line number 5 you see the new word that is called return. Return means that we give back something to the part of code that function. So if in number 9 I call the function as I ask for number and then that function will return to me the number that user input from their keyboard. So the word return basically means return this to whoever called me. After you finish you can run the program and it should work in exactly the same way as before. The only thing that we did was moving some part of our code to a function but the way it works didn't change. To run the program to make sure that it works if there is any error just raise your hand and one of the coaches will come to you to see what's wrong there. At this point our game is basically complete, right? It tells you that your number was too big or too small it allows you to to pick the number again it congratulates you when your number was correct and it finishes instead of going in the loop forever. Now we will add another function. What we will do is we will count the number of tries that you make before you guess the right number. We start with adding a new variable called number of tries and we will start with assigning the value zero because before we pick any number we try zero times so we will start with that value. What we need to do next is whenever user picks the number we need to increase that value by one. We do it here in line number ten right after the line with loop we say that number of tries then we use this weird combination of plus and equal one. What this weird combination of characters means that number of tries since now is whatever it used to be before plus one so that we can write it in two different ways. Line number ten and eleven are exactly the same so don't write both of them because then you will increase the value by two just pick one of them. The first one I know that it's clear for beginners so you can choose this one the other one is shorter so later it's more convenient to understand it. What I will do now here in this code is that because I want you to show two different versions of how you can do it but I don't want two of them to work so I will just add in the beginning of the line this hash character and what it means if you put it in the beginning of the line is that this will not matter for computer so that Ruby when executing this program will ignore this line so basically it is the same as if I removed it the only difference is that it stays here so maybe if something is not very clear I can explain it here in the comment but it will not be recognized it will not be used by computer at all now what we did was creating a new variable which is called number of tries and then increasing its value with every iteration of the loop what we want to do is to show the user how many tries they needed to guess the number so what we need to add is another line that will say you tried this number of times once you are done remember to run the program to see if it really counts the number of times correctly if it prints it in the end basically all we added if it's correct it works it works yes because I moved because I don't remember ok it is getting louder in the room which means everyone is done in a minute we will move further ok everyone the next step is very difficult to understand so I need your attention now what we will do is we will create a class called game and whenever we start we will create a new object a new instance of the game and we will run it this will allow us to later start the new games over and over whenever we want so what you need to do is just change these two lines add line number 1 and 2 the first line defines a class that we are creating so we are creating a type that is called game and then inside we create a function that will be called run and then as you remember if we create a class or if we create a function it starts with one line but then it needs to end with the line with the keyword end so if you go to the end of this file I will just show it for a moment you need to add these two ends here to finish the class this is the method and then in the last line we put game.new.run I will go back here in a moment now I will go to the beginning so that everyone can catch up so again in the beginning of the file we add the line class game remember that here is capital G this is very important inside we create method a function called run and then we go to the end of the file and then we add these three lines here so we close the function with the word end later we close the class because the function was inside the class and then at the very end of the file we type game.new.run and if you finish it and run the program it should be exactly the same sorry I covered the text it should work exactly the same as it did in the previous step so it should ask you for a number and it should give you a hint every time you don't guess the beginning let me do it this way on the left you've got beginning and here on the right you've got end so that everyone can see if it's correct remember to confirm that the game should work exactly the same way as before let me close this now and we will go to the next step the next step contains of a very simple change we create this function called initialize and we move choosing the secret and number of tries to this method so before these two lines were inside method run but we will move it out of that function we will move it to function called initialize it's the next ah so these two lines these two lines here were here inside the run method we just move them up inside run function we move it to function called initialize after you finish check if it works if the game works the same way if it doesn't work the same way just raise your hand the thing is that in this step the game shouldn't work the same way I broke it on purpose so if it works the same way that it used to before this time means that you did something wrong here on the bottom you see the error message that you should see when you run the game now so in this in this step we broke it we will fix it in a moment and this is what you should see when you try to run it stick skill below 20 20 24 show me what's okay did anyone manage to get this error not yet once again what we did in this step was moving this line that generates the secret and there are number number of tries called zero we moved it from the from the inside of the function run we moved it instead to we moved it instead to new function that is called initialize this is one of the most common mistakes that programmers make works now this is the error message okay what happened here that we broke our program is that these two things are not available to the rest of the program outside of this function so here in the function initialize I create variable called secret and later I want to use it in a function called run but these variables this information is not shared between two different functions we call them local because they die basically they are over once the function ends what we need to do to fix it is to add this add character that I showed you before what we change here is that instead of just secret we have add secret and the same with number of tries but this is not this is not all because we need to find in our program every single time that we call this variable secret or this variable number of tries and we need to add the add character in front of them so we change these two lines line number 3 line number 4 we just add this one character here and later you see I have number of tries here already with this add character this is what we need to add wherever we want to use variables what this one character does it tells computer to share this information it means I don't want this information to be local anymore I want to share it with other functions once you finish and you run the program now it should work correctly it should ask you for a number and it should tell you when you want the game if it doesn't it means that you probably forgot to add this one character you can see once again every time you use secret for number of tries it needs to be prefixed with this one character as you may see we still have the variable guess here that we do not proceed with as one character this is because we do not share this variable we just created here inside this function so two variables are shared which means number of tries and secret and the guess variable is not shared because we created every single time inside this function now why do we do it this way is because the secret is the same for the whole game so if you try one time, if you try 20 times we want to share this information we don't want to create a new secret every time we try and the same with number of tries we want to remember what was the last value and we want to increase it by one but this one, guess this changes every time that user puts new number we do not need to remember what was your previous guess we do not care about it because it was wrong so we get a new one so the shared information needs to be preceded with this character but the information that we do not need to share that we do not need to remember about don't need it have you confirmed that the game now works correctly? if it still doesn't work raise your hand and the coach will come so what is this you can't remember you can't remember yes yes yes yes yes yes yes yes yes yes yes yes ok is anyone still having trouble with this program? ok then we'll move forward what we did right now is that we decided that users can choose players can choose pick number between 0 and 100 and now what we want to do is we want to allow them to change it and we will introduce something called constant constant is a value that we assign only once later we cannot change it so the most common constant that you will see in computer programs is for example number pi because this number never changes we just say that pi equals 3.1 etc and you will never change it in the whole program we create a number we create constant that is called maximum underscore number the convention is that the name of the constant is all in capital letters now in the line number 2 we only define this constant we say that maximum number equals 200 in my case you can choose any different number if you want if you want the game to be more difficult you can put 500 number 10 and then we use this constant when we generate our secret number so as you know before here we had 101 if we put 101 it means that we will pick a number that will be no greater no bigger than 101 so it will be from 0 to 100 so now we replace that with 101 with our maximum number plus 1 here if you're curious we can put spaces if it's easier to read in this case it doesn't matter it can be space plus 1 it can be without spaces and the last change we do is if you will see number 12 that says pick number between 0 and 100 even if our maximum number is 200 or 300 we still tell user choose number between 0 and 100 which is misleading because user will say 100 and we will say for example number is small so what we do is that we make this value dynamic we use this character hash and then we open curly braces and we put the maximum number what it means is that we change this single constant here let's say I change it to 300 both secret number will be picked from 0 to 300 and the information to the player will change automatically otherwise it's difficult to remember that we need to have the same number into places here we just change it once and it changes everywhere we wanted it to change after you do that you're running your program now it should say pick number from 0 to whatever maximum number you picked and it should choose the random number the secret from that group of numbers so if you choose that maximum number is 10 it should be impossible that it will pick 20 or 50 and if you put the maximum number equals million then it's very probable that it will be bigger than 100 so you can try that it actually chooses something bigger than 100 just to repeat what are the differences here so we've got three types of values that we assign so far one is called local variable which is for example here the guess it's just a name and it starts and it's only with small letters the second one is the shared variable that also uses small letters underscores and it starts with the add character both of them can change during the program run when the program runs so number of tries will change every time user picks another number and the third type is constant which is all capital letters and underscore character and this number shouldn't change so no matter how many times user plays this game while the program is running the value should be in my case 300 has anyone tried running and confirmed that actually the bigger or the smaller numbers are picked and that the information to user is correct here ok cool now we will introduce just one small change you go to the very end of your program and you copy the last line and paste it once again just this one simple change just repeat the last line and try to run the program and see what happens so what happens now is that the game will be run twice once you win the game for the first time it will pick another secret number it will start the game second time and after you win second time it will just close the program so this is already better than playing just once and then having to run the program again imagine that you play I don't know some solider or minesweeper on windows during work and you win the game and the window automatically closes and you have to go to the start menu again and choose it it's pretty annoying it's to run it as many times as we want we started with very simple change to run it twice but this is not enough we want to play it infinity lock so what we do is that we put this game.new.run inside a loop lock so we add this loop do inside we put game.new.run only once and then we finish it with the line that contains our previous version was to run the game twice and if we wanted it to run this way but infinite number of times we would have to just copy that line over and over and over but what we can do instead is we can use this word loop that we already use when we ask user to pick a number now when you run your game and you win it once and twice and three times it will still keep running and running and running and then as a few steps before you press the control on your keyboard the CTRL button you hold it and you press letter C then the program will end ok now there is a big change so pay attention what we will do is we will ask player before every game if she wants to play or if she wants to quit the game so first we add this value at the end of your file this is the end of the file inside the loop first we add these three lines I will say what do you want to do one play zero exit after these three lines we create new variable called choice and to this variable we assign the value that will be the function gets and then to underscore I it is the same as picking the number we take whatever user presses on the keyboard and then we convert it to a number once this is done we need to check what is the user's choice so if the player chooses one so we do this if block if the choice of the user then we use double equals character if the choice is one then we will put game.new.run and in the next line we say else if the choice is zero then break the break as you know will let us go out of this infinite loop so it's the same what we use when user wins the game we say yes you won and then we break to finish this infinite loop and then we add one more end because at the end of each if condition needs to be this line with the word end you're done and you run the program at first it should ask you what do you want to do and try different options try to say one try zero, try three try some ABC text or something else and see how the program behaves have you tried running it so for example if I press seven it should recognize it as incorrect because I only give the choice between one and zero so if it's seven it will just ask me again for the number if I press zero obviously it will finish the game for example if I press A or ABC it will quit because it tries to convert this text to a number it can't it just thinks that it's zero so any text that is not a number will be considered zero even if I don't press anything I just press enter it thinks that it's zero so it ends the game and obviously if I press one it asks me to pick the number yes so this is because when you create a game you do not execute it you just define it just this class game and the initialize method it's just it's not called, this function is not called there is a difference between creating a function which is like definition of it and then you can call it or not so yes we do not tell it to run the game so after you define this class first thing that it does is the loop so then it asks you okay does anyone need help just raise your hand if you have any questions doubts if something doesn't work okay I'll move to the next step then the next step will be to show the player what numbers they tried before guessing the right one for this we will use a new data type that we haven't defined yet so here inside the initialize method we create new variable called previous tribes and to this variable we assign these two characters these are two square brackets beginning of the beginning and the end what this represents is the data type called array or otherwise you can think of it as a list so the previous tries will start the first value of this variable will be empty list this list doesn't contain any elements so this is not a square these are like two characters everyone's got it so previous tries will keep a list of the numbers that we guessed before before we get the right one so now once we have it what we do is we go to this first loop this is line number line number 20 and what we say in this line number 20 is to the list of previous tries add the new element double less than sign means add the new element to the end of the list so this once again these are two characters but there can't be space between them you just need to put them together and the element that we add to this list is the guess so is the current number that user tried so far we did two things we created a list the empty list that will keep the information about all the tries that user makes and then whenever user is asked for number and picks the number we add this number to the list to remember what were the previous tries so if you run the program now it will do the same what it did before because we never show this information to the user so we collect this list but we never show it that's why to show it we need to go to the place where user is informed about the right guess so it's line number 2728 after the information you tried a number of times we add another your tries were and then we tell user then we tell the player what were their previous tries once you add it try running the game try winning it and when you win the game it should tell you what were all your previous tries if you are running the game remember to set the max number to something pretty low like 1 or 200 because if you set it to million it will take you some time to win it when you run the game and you win it you should see the information like this your tries were and then you should see a list of numbers inside the square brackets everyone managed to get the list of your tries so what you see now on the screen is this list that is represented by the square brackets characters but this is not something that we want to see so what we will do is we will format this list to be displayed only as a series of numbers as you would see it in a newspaper or in a book without the square brackets to do this we need just one change go to the line that says what were the previous tries and then after after the previous tries after this variable write this dot join and in the in the parenthesis just write double quote comma and space what we will do is that we say that the list of previous tries we want to join this list with a comma and space so instead of a list we will have a text we will have a string of characters that will that will consist of all these elements connected with comma and space if you finish and run the program and you win the game now you should see the message that doesn't have the square brackets say your tries were and then the list the list of numbers ok everyone got it the clear nice list of characters of numbers without the square brackets so the last thing that we will add today to this game is the difficulty levels so let me just go to the next file ok what we add now is we remove that constant that represented the maximum number because we want to have different difficulty levels so the more difficult the game will be the bigger the number we choose as the maximum number the more difficult it is to guess it so we remove that constant and instead to the initialize method we add this parameter called maximum number notice that this parameter is named with the small letters it's not capital letters anymore once we add this parameter we need to assign it here in the line number 3 to this variable with the art character so that we can share it between the functions and then here where we pick the secret number our parameter is not the constant the capital letters one anymore but we use this one that we share between functions so what we mean here is that whatever number we start the game with will be will be the maximum number that we can pick and the last change almost last change is here to replace once again replace that constant the maximum number in capital characters to the one with small letters and the art character in the beginning now you can try running the program and it should show you an error if you run it and it works it's wrong and you have managed to get an error already ok so the change that we need to add to fix that program is to provide the value for this maximum number what I mean is if you go to the end of the file oh it's not this one let me fix it ok so your program has game.new.rub but because the initialized function requires a parameter now we need to give it some value that will represent this maximum number so we will provide the value 100 here to start with this 100 here in parenthesis the game should work again remember that it's very important what is the order here so it's game.new then it's the value 100 and then it's .run ok everyone got it so at the beginning of the file we change the first three lines we add the maximum number parameter we assign it to the shared variable with the add character and wherever in the program we had the capital letters maximum number we need to replace it with the one small letters and the add character so it's here where we pick the secret and it's here where we display the maximum number to the player so that they know what is the maximum number they can pick once this is done we go to the file and we add the number 100 or 200 whatever you prefer as the parameter to that new method anyone is struggling with something anyone needs help just raise your hand I think I unplugged it yes I'm pretty sure of it ok why did we do that is that so we can introduce different levels of difficulty for the player so the next step the next step is to give user more choice so what I do here is that I say if you press 1 we will play easy level if you press 2 the medium level the third one will be difficult and then as you can see here in these lines lower I say that if user chose 2 then I will start the game with 200 as the maximum number if they start with 3 if they choose 3 then the maximum number is 300 so now instead of 2 options user has 4 they can play one of 3 level of difficulties and they can exit the game when you're done when you run the game it should ask you what do you want to do you can pick one of the 4 options and if you choose the one between number 1 and 3 then it should start the game with the different number as the maximum that you can pick if it doesn't work this way if it throws some error raise your hand tell us so that we can see what does it look like here it's just interesting to me if you go between number 1 and 3 but that's just yeah but I think the second one is the other one that looks good it shouldn't exit it shouldn't it doesn't exit oh I know what I'm asking did you pick it with 4 meter did you pick it with 4 meter like it did in 3.5 you could have been like 10 grand so what should you do I'm pretty sure I'm good we really want to take 10 grand so every number 1 we have to find here and just what it's for first game If you don't want to do it, then you just do it here. Okay, everyone made it work. Does anyone need any help? Raise your hand. We are slowly running out of time, so this is the last change that we do to our day today. We will not publish our codes, but in the email later, Elisha will send you a link to the video that will show you how to publish this code online. It will also contain the final version of the game that has a few more features so that if anyone of you is interested in building something more and seeing how step by step it can be extended or added, then you can just have a look. So we did the first version of the game that had the very basic functionality. We did the version number two that the program tells the player how many tries. Did it take to guess the correct number and what were the previous tries? The one that you will get online is a bit more advanced. It will remember the name of the player and their result. Then in the email you will get information about how to use the software called Git and GitHub to publish the code online. So this is used for whenever a team works on the software, we just share the code between us with this software. That is all for now. If you have any questions, just later reach me or any other coaches. For now, I just want to thank you for coming today and ask for some applause for the coaches that were helping together. Everyone feeling? Are you still feeling good? All of you are very confused. Fun learning, all the programming concepts, I think it's really, it's a lot to cover. We understand that. So just take time to really digest everything that you have learned today. So today's session is all recorded and we will have the recording up within two days. Also send more information on this, what is this, Git, GitHub thing and some learning resources for you to continue learning. So I will need a favor from all of you. So right now you should receive an email from, it's 5, right? Because I shared it with you to go up 5. So rather at 5 p.m. you will receive an email. So this will basically let you know what is the link to the Facebook group and also there's a link to the survey form that I hope all of you can really help us understand, read feedback from your side and also let us know how well we did and how we can improve. So that's all. Congrats on making it through the first workshop. Give yourselves an applause. So we have this space for maybe like half an hour or an hour. So you can feel free to try and you can stay and ask questions if you want or you can also leave an hour, see you next week. Thank you. Oh, okay, we're going to take another photo. This time it's not 360 but just a regular photo. Joelle, do you want to come here to, how do you want to coordinate? How about you, do you want to take it from there then I can get the group here to stand up? So people at that side, I need you to stand and then everyone else who can look at Joelle who's going to stand on a chair. Let's look at Joelle and look happy like you're not brain dead because three hours I'm on shop. Hi everyone, just to make sure you clear up your own trash. It does mean before you go, please. Thank you.