 So back in February of this year. I uploaded a video called introduction to condo 64 basic programming and this is a video inspired by my son Asking me if I could teach him how to code he was looking at an app I was working on and he said that's called Can you teach me? So I thought yeah great and You can watch the video for yourself, but we just coded a very simple very simple Non-optimized basic maths game and what it does is it asks you 10 addition questions So yeah one plus two one plus three, you know using random numbers And there's two difficulty settings And that would just determine really how big the integers were, you know, so for easy, you know You'd get things like one plus eight, you know nine plus two that sort of thing and the harder ones You just have bigger integers So it might be 47 plus 50. Well, anyway in the video Or maybe in response to one of the comments that I got that if you wanted to expand this game You know, this was an introduction to the common of 64 basic Yeah way to expand this would be to include the other operators so not just addition you could have subtraction division and multiplication and Slightly more challenging in that so subtraction for instance, you might you'd have to have a number Greater on the left than it is on the right. Otherwise, you get a negative number division you could end up with a fraction and Multiplication is easy enough, but certainly subtraction and division. Yeah. Well, anyway recently I had a comment from inner flap and He's Done exactly that. He's you know, he's risen to the to the challenge and created a version that encompasses all four operators for, you know, the four simple operators. So plus minus Addition subtraction multiplication and division. So, so great. Well done enough that here it is So he's created a version using BBC basic and supplied with the acron electron and the BBC model B so it's that version of basic and He's explained the various parts of the of the code and what they do and it's similar to common of 64 basic But there are certain things that I don't think the C64 basic has certainly CLS for clearing the screen It's a little more difficult on the common of 64, which is a little more long-winded really and repeats Until I don't believe that exists. So, you know, there are there are some differences But anyway, don't I did a BBC basic emulator. Here's the code pasted in I really like this this IDE because recognises whether the indentation should go so All this indented text here is within the repeat until you see so it makes it, you know It looks very modern this for loop again is Indented a bit more so you can see that the loop is separate do quite like that. Well, anyway, we're up further ado Let's play you guys ten sums one easy too hard if we put something other than one or two It handles that by asking again. So we can go for easy and Question one of ten. What is eight plus seven fifteen? Let's see if we can do this two times ten twenty one times four two divided by one eight minus two nine divided by three six minus four ten plus nine Oh ten out of ten. That's a relief. They ask you if you want another go or not. I'm gonna do that and Ask so I didn't do it in capitals There's a quirk of the BBC or certainly the simulator. Let's go for hard 24 divided by 12 and this is wrong I'm gonna show myself up 19 times 34. I've got no idea Seven out of ten. Okay, do you want another go? No, no this time. Oh Yeah, you can see there's the code. I've actually ported it to common or 64 basic. I've tried to keep it as Close to his one But there are some differences because of the quirks of the basic So there's no repeats. You see max equals 10 yet great. I've copied that straight over. Can't do the repeat Clear the screen is print character 147 Assign in a variable with zero. Yes, that's the same and then printing out you'll be asked That's all the all the same there. Let's see what the slight differences are. Oh, yeah It's got another repeat here. So What I've had to do is online 150 it asks it requests input, you know, if the one or two quit One or two. So it's asked the question So if D is less than one or greater than two so this time we are counting for it, you know Be an outside of what we want. We'll just it would just go to 100 You'll basically restart the program and that's so that it doesn't ask a line by line You know, it doesn't ask you again and again and again. So if I type three It's just gonna ask again and again and again. So my version would just reprint the screen So, you know, it looks like nothing's happened. I'll show you in a moment So I just thought that looked better to do that way. This is exactly the same this D assignment here depending on you know It just sets the variable bigger or smaller on the right-hand side Well on both sides actually for D and depending on whether you put one or two So that's how recently mine how it determines that the difficulty just by with bigger integers Okay, and then we do enter a for loop So question one two max. So one to ten. They're in a random number. Now This is different on the on cobalt 64 by six C over here on the BBC Nice and simple isn't it get a random number? I'm guessing between one on four To do that on cobalt 64 You do use the R&D Command that is still the same, but we have to seed it You know to put what kind of random number do we want is a mistake? So we want an integer. So I have to specify that there All right, there we go folks So when an integer using one as the seed, all I can remember is that one gives you the most random Okay, the other two are just I just less although between one and four How random is it gonna be anyway and the way it works on the common 64 the R&D function It would be zero to four. Okay. We're not inclusive. So you'd actually get zero to three So by adding one to this whole thing, it shifts it up by one. So then you get one to four inclusive Okay, and then we assign a and B with different random integers Up to wherever the value is in D Okay, and that will be depending on pick one or two the size of the integer that it will go up to And then we choose then we're having to look at the the symbol Okay, and we have to generate a symbol. So if this random number is four or be division Okay, so four be division. So if we've got division, we have to test it So a divided by B if that's not equal to an integer, then we just repeat on 90 We load different random numbers into those variables We test it again until we get one that would be the where the result would be an integer if it's two which would be subtraction We do a test if a less B is less than zero then let's just choose some more Random numbers until we get one where you know a is greater than B Therefore it won't be less than zero then we'll ask the question So first of all it's saying print. This is question and then the number of max So the first time right at the question one of ten leave a blank line and then symbol variable the sim string variable is going to have put in it and Random number between one well depending what the random number is between one to four. It'll pick One of the spaces within this string. So one being plus two being subtraction three being multiplication for being division And this is what is? The first integer the symbol has been picked and then the the second integer They asked for the input then it checks. So if it was an addition question Yeah, well if C the answer is equal to a plus B then great We increment the score by one and subtraction and C is equal to a minus B increment the score If it was multiplication and C is equal to a times B increment score if it's division and you get the idea If none of them result in true We're still going to go to the next step of the loop the next question But the score won't have been incremented. Okay at the end we clear the screen We say you scored wherever the score is out of max out of ten and obviously we can change max With it being a variable set up here at the start you scored x of y Do you like another go and this is where it's slightly different? We can't use the until Q is not equal to y You have to you don't have to in the previous version anything other than a y. I'll set it to would Would end the game. Okay? I wouldn't you know tidy that up and it would be you have to select y or n or press run stop obviously If why then go to 100 completely restart the program from the start Otherwise, it's n. So if it's n we go to 380 skips us down here Which is thanks for playing that ends the game if none of these are true Then we hit this go to which takes us back here clears the screen and asks again It's a similar top here We just keep asking asking again till we get an input that we expect it would do that down here Anyway without further ado, so here we have the vice emulator and for it run actually Let's just see the codes So we're in there. Let's run it. We are 10 sums one easy or two hard. Let's go for easy Now you might notice sometimes there's a delay in the next question being asked. It's the division ones. You see And that's because it's quite likely the first time around you'll get a You know some that would leave with a fraction, you know our floating point number is the answer It's only on the division ones there. So it just not that noticeable most of the time It was noticeable sometimes not so much them when I was just playing it through Typically for the video, but yeah, you'll see that there could be a bit of a pause sometimes asking a division question But there you go. Thanks very much to inner flap For taking the time to you know expand on the on the game and make it the full version if you like go check it out the code is in the comment of that old video and I will put a link to the code for this one In in the description for the commoner 64 version. Bye for now