 Welcome to basic programming rock paper scissors now when I say basic I mean beginners all-purpose symbolic instruction code This is the follow-up video to my basic programming introduction video if you haven't seen that this probably won't make a lot of sense But so go back and watch that first. I'll put a link down below first quick shout-out to my channel members Thank you so much for supporting the channel if you can join down below if not subscribe click the bell and click like Thank you everyone. So getting started here Real quick. I am using replets and again, this was discussed in the previous video So this is basically just I'm just finished the last video moving right into this Just decided to separate it out because my throat was getting sore and I needed to get a drink. So here is Basic interpreter and this is a very old-school style of basic interpreter And what I want to do is a quick rock paper scissors program. So I'm gonna go ahead and start with the REM which means is a comment so I'm gonna call this, you know rock paper scissors in basic Buy at Tokyo at Tech that is me Any I just explained in the previous video what REM means if you didn't watch that watch go back and watch it Okay, so I'm gonna go ahead and throw in a command called CLS Now, I don't think it really works on this version of basic, but it worked on most versions of basic Let me just check something settings Yeah, the font size is large. So hopefully that's coming across in the video. I want it to too big Everything on one page. Okay, there we go. So Let's go ahead and get started here. So I'm gonna go ahead and print The title so a rock paper Scissors Is it answers or just scissors? I'm not sure Okay, and then so think about the game what we need to do then is to ask the player to choose I'm gonna say input And here's how we used to type it rock paper Or and then I have to give it a value or I have to give it to put that into a variable So now we are playing against the computer okay, so The player of course is choosing rp or s the computer on the other hand Can't do that the computer has to shoot what we're gonna do is we're gonna use a random number So we're gonna say let R. It's gonna be our random number equal int r and d times three parenthesis plus one What that will do is it will give us a random number from one to three Or it would be zero to two without the plus one, but I think I find it easier with one two and three so this returns a random number from zero to zero point nine nine nine nine nine and Then we multiply that by three Ints will take off the decimal part of that so that'll give us either zero one or two and Then we just add one to give us one two or three so then we just need some if statements so if R equals one notice that's one equal sign Because we're in basic not Python then I'm gonna call this computer equals R Okay, if R equals two then computer equals P And if R equals three then computer equals s now for the record I didn't have to convert this to rp or s That was really just a convenience for the the coding that we're gonna do later. Oh, what did I forget line numbers? 60 And 70 And then so what I'll do is I'll just go ahead and print out what the computer chose. I'll say print the computer chose shows Plus computer Plus a period the end there. Okay, so let's go ahead and test that and see if it's working so far Okay, so I'm gonna go ahead and hit R and the computer chose s I'm gonna go ahead and test this again. I'm gonna see if all of the options come up. So we got s again s Hmm did I make a mistake with my code or is it just interesting? That's possible. I made a mistake here somewhere with a code, but I don't think I did Okay, the computer chose our finally, okay And the only thing we haven't seen is P So I should probably keep going but if we have r and s will probably Eventually end up with P. There you go. Okay, so it's what but it's always good practice to test to make sure all the Values eventually come out. Okay, so now what we got to do is we have to deal with all of the possible situations So I'm gonna go ahead and do Say tie game so this one's kind of the easiest one so if player equals computer Then print tie because if I chose rock and the computer chose rock And again, I start putting these line numbers back in it's really it's really hard to have it to break because I haven't used line numbers Oh and about three decades 110 So I'm gonna say our em, you know player wins So I go 120 so if player equals rock and computer equals Rock-beat scissors then Print Player wins the other way the player can win if player equals scissors and Computer equals paper then print player wins and Sorry, there's actually one more if Player equals Quotation mark there. I'm not sure why the syntax highlight is not working. It's really annoying rock scissors and paper and Computer equals rock then print player wins and Then now we want to do the same thing for the if the computer wins. So 140 I am computer wins. Okay, so 150 so if Computer equals are and player equals scissors then print computer wins 160 if computer Computer equals scissors. I shouldn't rock paper scissors in order, but and Player equals paper Then so you take that you just go through each option one at a time then print computer wins It's no computer on there And our last option is 170. It's if computer equals access paper and player Platter Player equal paper beats rock then then print Computer Okay, so let's go ahead and play this game Line 120 so I got 120 twice again. This is why we put 10 between so because I got 120 twice I'm gonna go ahead and hit one make that 125 Again, this was the common way of approaching this problem. Okay, so I'm gonna go ahead and play the rock Computer chose s player wins so rock beats scissors Okay, go ahead and try paper If you chose rock player wins, I'm liking this game so far and scissors Ripple it stopping. What the heck happened there? Oh, it's gonna run that. I chose scissors If you chose scissors tie, okay So it seems like it's working now What we should do is go through and test all the possible values But we'll just assume that it's working for this particular case And the last thing I want to do is I want to ask if the player wants to play again. I'm gonna say inputs Play again, and then I might call this you know play again And then 190 if play again equals yes Then it's then go to go go and go to the start which is clear screen. So go to line 10 Otherwise, we just end the game. We'll say 200, you know print Okay Thanks for playing Let's go ahead and try that so rock Computer chose P computer wins Play again. Yes Rock paper scissors say P here chose P tie. I don't want to play again. Okay. Thanks for playing So that is it. That's a pretty quick and easy Basic program to play rock paper and scissors So those of you that have done rock paper scissors with me personally if you're one of my students or Rock paper scissors. I think I have a rock paper scissors tutorial somewhere If I don't sorry, but you can see how all Computer languages or at least computer languages have very similar structures. Okay, so we've got print We've got inputs. We can set value. We can set variables to certain values We have if then I didn't use it. We have else. I don't think there's else if in this version of basic though And then we have comments So if and then we're able to jump to different parts of the program now again in a modern computer We might use a while true loop or we might use functions rather than go to a course But the concept remains the same and the structure is overall the same So hope you enjoyed that again this version of basic has a lot of extra things that has some graphics and things that you can use I haven't played around with that again every version of basic every system had its own little Quarks has own little things that it could do that the others couldn't which kind of limited the compatibility But as long as you stuck the text mostly things would work the same It really was a golden era in many many ways. So thanks for thanks for watching and Yeah, keep on coding again. Thanks to members like subscribe or join down below. Thanks so much. Take care